While trying to reproduce Chirstopher's problem (in mutt-users) updating my Mutt, I discovered something interesting: the source command no longer appears to recognize my pipes, and instead tries to stat the command, promptly discovering the file doesn't exist. Looking at the code, the problem is pretty obvious. A recent patch to init.c (the one that was supposed to prevent Mutt from silently failing to read nonexistant RC files, IIRC) changed source_rc() to stat(2) the RC "file" before trying to mutt_open_read() it. There's only one problem here: source_rc() has no way of knowing whether or not its "file" is a file or a command. I'm attaching a patch that fixes the problem in what I believe is the right way. - Dave -- Uncle Cosmo, why do they call this a word processor? It's simple, Skyler. You've seen what food processors do to food, right? Please visit this link: http://rotter.net/israel
? mutt/build ? mutt/stamp-h1 Index: mutt/init.c =================================================================== RCS file: /home/roessler/cvs/mutt/init.c,v retrieving revision 3.19 diff -u -r3.19 init.c --- mutt/init.c 1 Feb 2004 18:00:16 -0000 3.19 +++ mutt/init.c 6 Feb 2004 20:29:08 -0000 @@ -1368,18 +1368,6 @@ char *linebuf = NULL; size_t buflen; pid_t pid; - struct stat s; - - if (stat (rcfile, &s) < 0) - { - snprintf (err->data, err->dsize, _("%s: stat: %s"), rcfile, strerror (errno)); - return (-1); - } - if (!S_ISREG (s.st_mode)) - { - snprintf (err->data, err->dsize, _("%s: not a regular file"), rcfile); - return (-1); - } if ((f = mutt_open_read (rcfile, &pid)) == NULL) { Index: mutt/muttlib.c =================================================================== RCS file: /home/roessler/cvs/mutt/muttlib.c,v retrieving revision 3.18 diff -u -r3.18 muttlib.c --- mutt/muttlib.c 1 Feb 2004 17:10:43 -0000 3.18 +++ mutt/muttlib.c 6 Feb 2004 20:29:09 -0000 @@ -1134,6 +1134,8 @@ FILE *mutt_open_read (const char *path, pid_t *thepid) { FILE *f; + struct stat s; + int len = mutt_strlen (path); if (path[len - 1] == '|') @@ -1149,6 +1151,16 @@ } else { + if (stat (path, &s) < 0) + { + mutt_error (_("%s: stat: %s"), path, strerror (errno)); + return (NULL); + } + if (!S_ISREG (s.st_mode)) + { + mutt_error (_("%s: not a regular file"), path); + return (NULL); + } f = fopen (path, "r"); *thepid = -1; }
Attachment:
pgpapLHzYxtIe.pgp
Description: PGP signature