Re: [PATCH] Clear filename line when uninstalling

2003-03-14 Thread Robert Collins
On Fri, 2003-03-14 at 15:02, Igor Pechtchanski wrote:
> This one-line patch clears the line containing the filename when replacing
> packages.  This avoids the last filename of the previous package being
> displayed while the next is uninstalled.
>   Igor
> ==
> ChangeLog:
> 2003-03-13  Igor Pechtchanski <[EMAIL PROTECTED]>
> 
>   * install.cc (replace_one): Clear Text3.

Cool. Approved.

I'll apply it when I get time ;}, or Max, you can apply it now.

Rob
-- 
GPG key available at: .


signature.asc
Description: This is a digitally signed message part


Re: Ok, to upload grace ? was Re: Pending packages status (10 Mar2003)

2003-03-14 Thread Pavel Tsekov
On Thu, 13 Mar 2003, Pavel Tsekov wrote:

> > In that case:
> > 
> > Ready for upload to s.r.c as soon as someone with the relevant permissions
> > has a moment.
> > 
> > BTW, keep the URLs in the message:
> > http://www.scytek.de/cygwin/grace-5.1.12-1.tar.bz2
> > http://www.scytek.de/cygwin/grace-5.1.12-1-src.tar.bz2
> > http://www.scytek.de/cygwin/setup.hint

Uploaded. Please, send the announcement in a few hours.

Thanks!




Setup postinstall logging (was Re: Pending setup patches (issue 2))

2003-03-14 Thread Igor Pechtchanski
On 10 Mar 2003, Robert Collins wrote:

> On Wed, [EMAIL PROTECTED]:52, Igor Pechtchanski wrote:
> > On 5 Mar 2003, Robert Collins wrote:
>
> > > Other than that, please expand to address all scripts.
> > > Rob
> >
> > Rob,
> >
> > There is a design issue here that I'd like to address before I work more
> > on this.  I recall your comment that this should be tied into the logging
> > subsystem.  Unfortunately, this would involve a much more complex code,
> > with pipes and forks.  The same is true if we want "tee"-like behavior,
> > i.e. windows popping up *and* output going to a file.  The way this is
> > implemented now is the output stream of the script process is tied to a
> > file, but the limitation is that the file is written right away.  Do we
> > want a more complex design now, or should I just allow running a generic
> > script with output going to a file (for the moment)?
> >   Igor
>
> Hmm, I'd like the following idiom:
> generate to a file.
> copy the file into the log buffer.
>
> That will get the postinstall scripts into the log.
>
> Howabout that?
> Rob

Ok, here's the next iteration of this patch.  It still pops a console with
nothing in it when running postinstall scripts -- I'm sure there's a way
to remove it, but can't find it at the moment.  It does, however,
correctly redirect the output of postinstall scripts into the LOG_BABBLE
file.  Most of the patch is OS-independent, but the output redirection
mechanism has been tested on Win95 by Brian Keener (see
) and hasn't been
changed in this patch.
Igor
P.S. Note that this patch conflicts slightly with my other patch
(postinstall script ordering).  Nothing a human can't fix, but both at
once will not apply cleanly OOTB.  Whichever one of them goes in first,
I'll regenerate and resubmit the other one.
==
ChangeLog:
2003-03-13  Igor Pechtchanski <[EMAIL PROTECTED]>

* script.cc (run): Add lname parameter.
Redirect output of subprocess to file, creating the
path if necessary.
(run_script): Add optional to_log boolean parameter.
If to_log, redirect output to temporary file.
(openOutputLog): New helper function.
(closeOutputLog): New helper function.
(removeOutputLog): New helper function.
* script.h (run_script): Add optional to_log parameter.
* log.h (log_file): New function.
* log.cc (log_file): New Function
(BUFLEN): New #define.
* postinstall.cc (RunFindVisitor::visitFile): Pass
filename to run_script().

-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune
Index: postinstall.cc
===
RCS file: /cvs/cygwin-apps/setup/postinstall.cc,v
retrieving revision 2.9
diff -u -p -r2.9 postinstall.cc
--- postinstall.cc  19 May 2002 03:07:51 -  2.9
+++ postinstall.cc  13 Mar 2003 18:34:51 -
@@ -33,7 +33,7 @@ public:
   RunFindVisitor (){}
   virtual void visitFile(String const &basePath, const WIN32_FIND_DATA *theFile)
 {
-  run_script ("/etc/postinstall/", theFile->cFileName);
+  run_script ("/etc/postinstall/", theFile->cFileName, TRUE);
 }
   virtual ~ RunFindVisitor () {}
 protected:
Index: log.cc
===
RCS file: /cvs/cygwin-apps/setup/log.cc,v
retrieving revision 2.13
diff -u -p -r2.13 log.cc
--- log.cc  27 Jun 2002 11:01:10 -  2.13
+++ log.cc  14 Mar 2003 17:12:21 -
@@ -36,6 +36,8 @@ static const char *cvsid =
 
 #include "io_stream.h"
 
+#define BUFLEN 1000
+
 void 
 log (enum log_level level, String const &message)
 {
@@ -45,9 +47,38 @@ log (enum log_level level, String const 
 void
 log (enum log_level level, const char *fmt, ...)
 {
-  char buf[1000];
+  char buf[BUFLEN];
   va_list args;
   va_start (args, fmt);
-  vsnprintf (buf, 1000, fmt, args);
+  vsnprintf (buf, BUFLEN, fmt, args);
   log (level, String(buf));
+}
+
+void
+log_file (enum log_level level, String const &filename)
+{
+  char buf[BUFLEN];
+  int num;
+  bool non_empty = false;
+  io_stream *f = io_stream::open(String("cygfile://") + filename, "rt");
+  if (!f)
+{
+  const char *err = strerror (errno);
+  if (!err)
+   err = "(unknown error)";
+  note (NULL, IDS_ERR_OPEN_READ, filename.cstr_oneuse(), err);
+  return;
+}
+
+  std::ostream &out = LogSingleton::GetInstance()(level);
+  while ((num = f->read(buf, BUFLEN-1)) != 0)
+{
+  buf[num] = '\0';
+  out << buf

emac for X11 throws error about entry point SmcClientID not be located in libSM.dll

2003-03-14 Thread Haibing Ma
I'm using win2000. I installed emacs-X11 and xfree86 for cygwin. When I
tried to run emacs, it throws an error window saying: The procedure
entry point SmcClientID could not be located in the dynamic link
library libSM.dll. I saw some mail talking about rebase or not rebase.
Is there a solution to it. Or my setup screwed up something? Or I need
to find a good mirror site to download?

My emacs-nox works fine.

Thanks for your help.

Haibing

__
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com


[PATCH] Postinstall script ordering in setup - take 3

2003-03-14 Thread Igor Pechtchanski
On 5 Mar 2003, Robert Collins wrote:

> [snip]
> Any, as I don't have time to complete implementing the dpkg or rpm
> behaviour in this regard for setup until the end of the current ice age,
> it would be silly to not let in a reasonably implemented alternative.
>
> Thus - I think this is a short term bandaid, because it increases work,
> not decreases it, and there is a better solution out there, as shown by
> the other package managers.
>
> Rob

Ok.  Here's that alternative, more reasonably implemented, and *tested*
this time :-) (at least as far as reading files, sorting them, and
executing scripts is concerned).  The dependence-extraction mechanism
still needs to be verified, though.  Comments and suggestions for
improvement are welcome.
Igor
==
ChangeLog:
2003-03-03  Igor Pechtchanski <[EMAIL PROTECTED]>

* postinstall.cc (RunFindVisitor::executeAll): New
member function that propagates script dependencies,
topologically sorts the script list, and then executes
the scripts (via other calls).
(RunFindVisitor::visitFile): Change to add script to
list instead of running it immediately.
(RunFindVisitor::files): New member variable.
(RunFindVisitor::checkAndLogMissingDependencies): New
member function.
(FileDesc): New class that extracts and stores
dependencies from a script file.
(DEPEND_STR): New #define.
(do_postinstall): Add executeAll() call.

-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune
Index: postinstall.cc
===
RCS file: /cvs/cygwin-apps/setup/postinstall.cc,v
retrieving revision 2.9
diff -u -p -r2.9 postinstall.cc
--- postinstall.cc  19 May 2002 03:07:51 -  2.9
+++ postinstall.cc  14 Mar 2003 17:40:09 -
@@ -26,6 +26,144 @@ static const char *cvsid =
 #include "mount.h"
 #include "script.h"
 #include "FindVisitor.h"
+#include "io_stream.h"
+#include "resource.h"
+#include "msg.h"
+#include "log.h"
+#include 
+#include 
+#include 
+
+#define DEPEND_STR "depends on: "
+#define BUFLEN 500
+
+class FileDesc
+{
+public:
+  FileDesc(String const &filename);
+  String const &path() { return _path; }
+  std::set const & dependencies() { return _dependencies; }
+  bool addDependency(FileDesc *dep) {
+return _dependencies.insert(dep).second;
+  }
+  bool addDependency(String const &deps) {
+// TODO: free unused map entries
+return addDependency(create(deps));
+  }
+  void propagateDependencies() {
+// TODO: detect circular dependencies
+if (_mark) return;
+_mark = true;
+for (std::set::iterator i = _dependencies.begin();
+i != _dependencies.end();
+++i)
+  {
+   (*i)->propagateDependencies();
+   for (std::set::iterator d = (*i)->_dependencies.begin();
+d != (*i)->_dependencies.end();
+++d)
+ addDependency(*d);
+  }
+  }
+  bool operator == (FileDesc const &f) const {
+return _path == f._path && _dependencies == f._dependencies;
+  }
+  bool operator > (FileDesc &f) {
+return (_dependencies.find(&f) != _dependencies.end());
+  }
+  bool operator < (FileDesc &f) {
+return (f > *this);
+  }
+
+  static FileDesc *create(String const &path) {
+FileDesc *&fd = fdmap[path];
+if (fd == NULL) fd = new FileDesc(path);
+return fd;
+  }
+private:
+  String _path;
+  std::set _dependencies;
+  bool _mark;
+  char _buf[BUFLEN];
+  char const *commentString();
+  char *readDependencyLine();
+
+  static std::map fdmap;
+};
+
+char const *FileDesc::commentString()
+{
+  char const *ext = strrchr (_path.cstr_oneuse(), '.');
+  char const *cmt = NULL;
+  if (strcasecmp(ext, ".sh") == 0)
+cmt = "#";
+  else if (strcasecmp(ext, ".bat") == 0)
+cmt = "rem";
+  return cmt;
+}
+
+#define WHITESPACE " \t"
+
+char *FileDesc::readDependencyLine()
+{
+  io_stream *f = io_stream::open(String("cygfile://") + _path, "rt");
+  if (!f)
+{
+  const char *err = strerror (errno);
+  if (!err)
+   err = "(unknown error)";
+  log (LOG_TIMESTAMP, String("error: unable to open script ") +
+  _path + " for reading: " + err);
+  return NULL;
+}
+
+  // Read first line after shbang (if any)
+  f->gets(_buf, BUFLEN);
+  if (*_buf == '#')
+{
+  char *bang = strtok(_buf+1, WHITESPACE);
+  if (bang != NULL && *bang == '!')
+   f->gets(_buf, BUFLEN);
+  else
+*(bang+strlen(bang)) = ' ';
+}
+
+  delete f;
+
+  // Check if a dependency line
+  char

Re: Setup postinstall logging (was Re: Pending setup patches(issue 2))

2003-03-14 Thread Robert Collins
On Sat, 2003-03-15 at 04:32, Igor Pechtchanski wrote:


> > Howabout that?
> > Rob
> 
> Ok, here's the next iteration of this patch.  It still pops a console with
> nothing in it when running postinstall scripts -- I'm sure there's a way
> to remove it, but can't find it at the moment.

Don't worry. What would be good would be to make it start minimized.

>   It does, however,
> correctly redirect the output of postinstall scripts into the LOG_BABBLE
> file.  Most of the patch is OS-independent, but the output redirection
> mechanism has been tested on Win95 by Brian Keener (see
> ) and hasn't been
> changed in this patch.
>   Igor
> P.S. Note that this patch conflicts slightly with my other patch
> (postinstall script ordering).  Nothing a human can't fix, but both at
> once will not apply cleanly OOTB.  Whichever one of them goes in first,
> I'll regenerate and resubmit the other one.

Ok, thank you.

> ==
> ChangeLog:
> 2003-03-13  Igor Pechtchanski <[EMAIL PROTECTED]>
> 
>   * script.cc (run): Add lname parameter.
>   Redirect output of subprocess to file, creating the
>   path if necessary.
>   (run_script): Add optional to_log boolean parameter.
>   If to_log, redirect output to temporary file.
>   (openOutputLog): New helper function.

This should return void and throw an exception on failure...
OR
use a class and set a status member.

>   (closeOutputLog): New helper function.
>   (removeOutputLog): New helper function.
>   * script.h (run_script): Add optional to_log parameter.
>   * log.h (log_file): New function.
>   * log.cc (log_file): New Function
>   (BUFLEN): New #define.
>   * postinstall.cc (RunFindVisitor::visitFile): Pass
>   filename to run_script().

The define BUFLEN should be a static const member of the class.

A general nit (just some search n replace for you) - I'd like new
methods and variables to make sense at first read. So 'lname' isn't
great. logFilename would be good. Likewise log_file isn't clear that it
imports a text file into the setup log. Oh, and I loath the MS idiom of
including the type in the variable name - bInheritHandles being a case
in point.

Other than those sugar things, the code looks great. Please update the
patch and then I'll rubber stamp it.

Rob

-- 
GPG key available at: .


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] Postinstall script ordering in setup - take 3

2003-03-14 Thread Robert Collins
On Sat, 2003-03-15 at 05:06, Igor Pechtchanski wrote:

> Ok.  Here's that alternative, more reasonably implemented, and *tested*
> this time :-) (at least as far as reading files, sorting them, and
> executing scripts is concerned).  The dependence-extraction mechanism
> still needs to be verified, though.  Comments and suggestions for
> improvement are welcome.
>   Igor
> ==
> ChangeLog:
> 2003-03-03  Igor Pechtchanski <[EMAIL PROTECTED]>

I'd like you do keep the class declaration free of code. It's fine to
have it in the .cc file if it's really trivial an private, but even then
can you put the implementations outside the class declaration. (With one
exception: one-liners.

>   * postinstall.cc (RunFindVisitor::executeAll): New
>   member function that propagates script dependencies,
>   topologically sorts the script list, and then executes
>   the scripts (via other calls).
>   (RunFindVisitor::visitFile): Change to add script to
>   list instead of running it immediately.
>   (RunFindVisitor::files): New member variable.
>   (RunFindVisitor::checkAndLogMissingDependencies): New
>   member function.
>   (FileDesc): New class that extracts and stores
>   dependencies from a script file.

The logic in here looks almost identical to that in
packageversion::set_requirements. I don't want to add near-duplicate
code if we can avoid it. Perhaps extracting the core for both to a
convenience class?

Your operator > and < appear to have a problem.

foo: bar
gam: bar

foo > gam= false
gam < foo= false
gam == foo   = false.

I'd expect stl associative containers to choke on that.

I suggest you do
{
  /* we are greater than any dependency of ours */
  if (_dependencies.find(&f) != _dependencies.end())
return true;
  return _path > f._path;
}

this
+  const char *err = strerror (errno);
+  if (!err)
+   err = "(unknown error)";

could be usefull extracted so that we can do
  String const errorString ( StringError(errno)); 
and always get back a string.


>   (DEPEND_STR): New #define.

BUFLEN should be a static const member of the class.

>   (do_postinstall): Add executeAll() call.

Thanks again for all the work you've put into this.

I've actually got some time today (gasp!), so I'm going to review the
current install script ordering - I'd like to apply your work to the
package dependency script ordering, which is currently not implemented.

Rob

-- 
GPG key available at: .


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] Postinstall script ordering in setup - take 3

2003-03-14 Thread Igor Pechtchanski
Rob,

I have to run now, so I'll reply in more detail tomorrow.  One quick
comment below.

On 15 Mar 2003, Robert Collins wrote:

> The logic in here looks almost identical to that in
> packageversion::set_requirements. I don't want to add near-duplicate
> code if we can avoid it. Perhaps extracting the core for both to a
> convenience class?
>
> Your operator > and < appear to have a problem.
>
> foo: bar
> gam: bar
>
> foo > gam= false
> gam < foo= false
> gam == foo   = false.
>
> I'd expect stl associative containers to choke on that.
>
> I suggest you do
> {
>   /* we are greater than any dependency of ours */
>   if (_dependencies.find(&f) != _dependencies.end())
> return true;
>   return _path > f._path;
> }

Not really.  I read up on that specifically.  stl containers only need a
*partial* order.  What you're suggesting will create a total order.  Not
an error, but overkill.  The sort function is supposed to be stable and
keep the original order if the lessThan relation is undefined.  See


> Thanks again for all the work you've put into this.
>
> I've actually got some time today (gasp!), so I'm going to review the
> current install script ordering - I'd like to apply your work to the
> package dependency script ordering, which is currently not implemented.
>
> Rob

Go ahead.  If you need my input, feel free to send chunks of design/code
to the list; I'll reply to them and to the rest of this message tomorrow.
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune



Re: emac for X11 throws error about entry point SmcClientID not be located in libSM.dll

2003-03-14 Thread Igor Pechtchanski
Wrong mailing list, redirected.  For your convenience, I've set the
Reply-To: field to point to the correct list.  Please remove
 from further replies.  Thanks,
Igor

On Fri, 14 Mar 2003, Haibing Ma wrote:

> I'm using win2000. I installed emacs-X11 and xfree86 for cygwin. When I
> tried to run emacs, it throws an error window saying: The procedure
> entry point SmcClientID could not be located in the dynamic link
> library libSM.dll. I saw some mail talking about rebase or not rebase.
> Is there a solution to it. Or my setup screwed up something? Or I need
> to find a good mirror site to download?
>
> My emacs-nox works fine.
>
> Thanks for your help.
> Haibing

-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune