* Ispell file permissions problem
@ 2002-07-18 4:05 Geoff Kuenning
0 siblings, 0 replies; only message in thread
From: Geoff Kuenning @ 2002-07-18 4:05 UTC (permalink / raw)
To: cygwin
Perhaps you can help me,
I got a bug report from an ispell user that under Cygwin his
spell-checked files are winding up mode 444. The relevant code from
ispell.c, the end of update_file, is as follows (HAS_RENAME is
defined; MSDOS is defined; xflag is false, the first "if" succeeds,
filename is "test.txt", and bakfile is "test.txt.bak"):
if (strncmp (filename, bakfile, pathtail - bakfile + MAXNAMLEN) != 0)
(void) unlink (bakfile); /* unlink so we can write a new one. */
#ifdef HAS_RENAME
(void) rename (filename, bakfile);
#else /* HAS_RENAME */
if (link (filename, bakfile) == 0)
(void) unlink (filename);
#endif /* HAS_RENAME */
/* if we can't write new, preserve .bak regardless of xflag */
if ((outfile = fopen (filename, "w")) == NULL)
{
(void) fprintf (stderr, CANT_CREATE, filename, MAYBE_CR (stderr));
(void) sleep ((unsigned) 2);
return;
}
#ifndef MSDOS
/*
** This is usually a no-op on MS-DOS, but with file-sharing
** installed, it was reported to produce empty spelled files!
** Apparently, the file-sharing module would close the file when
** `chmod' is called.
*/
(void) chmod (filename, statbuf->st_mode);
#endif
while ((c = getc (infile)) != EOF)
(void) putc (c, outfile);
(void) fclose (infile);
(void) fclose (outfile);
if (xflag
&& strncmp (filename, bakfile, pathtail - bakfile + MAXNAMLEN) != 0)
(void) unlink (bakfile);
The execution path is such that the first unlink(bakfile) is done,
and the final unlink(bakfile) is not.
Since I rename "filename" out of the way before opening it, I can't
see why it would be created with a mode other than 600 or 644. The
user says that he's running with a umask of 0, so that explanation
doesn't work.
Any thoughts? I unfortunately don't have a Cygwin platform to play
with, and don't know much about the system. But I'd like to have a
workaround for the guy.
--
Geoff Kuenning geoff@cs.hmc.edu http://www.cs.hmc.edu/~geoff/
The DMCA criminalizes curiosity. It would put Susie in jail for
taking her stereo apart to see how it works.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-07-18 8:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-18 4:05 Ispell file permissions problem Geoff Kuenning
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).