Date: Mon, 6 Jan 2003 06:03:12 +0200 From: Giorgos Keramidas <keramida@freebsd.org> To: "Gary W. Swearingen" <swear@attbi.com> Cc: doc@freebsd.org Subject: Re: docs/46787: compress(1) manpage missing BUGS; other cleanup. Message-ID: <20030106040312.GA6593@gothmog.gr> In-Reply-To: <5zy95zknwe.95z@localhost.localdomain> References: <hjk7hjmpdz.7hj@localhost.localdomain> <20030105225020.GA2565@gothmog.gr> <5zy95zknwe.95z@localhost.localdomain>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2003-01-05 18:33, "Gary W. Swearingen" <swear@attbi.com> wrote: > For easiest example is to copy a plain text file to "xxx" and do > "ls xxx*; uncompress -f xxx"; ls xxx*. Gone. Try it again and also > copy a different size file to "xxx.Z". Gone. Try it once more but > ensure that "xxx.Z" is a real compressed file. Not gone, just > overwritten, as the manpage has always said. > > Thanks for your comments. Well, thank you to for reporting this! I think I have located the source of this bug. I just added the following comment to a local tree, and I'm off to bed since it's way past my bedtime. Tomorrow, I will try to fix this and ask the friendly reviewers of freebsd-audit to bitch at me until the bug is fixed in a way that makes everyone happy :=) %%% Index: compress.c =================================================================== RCS file: /home/ncvs/src/usr.bin/compress/compress.c,v retrieving revision 1.20 diff -u -r1.20 compress.c --- compress.c 28 Jul 2002 15:32:17 -0000 1.20 +++ compress.c 6 Jan 2003 03:56:32 -0000 @@ -170,6 +170,19 @@ len = strlen(*argv); if ((p = rindex(*argv, '.')) == NULL || strcmp(p, ".Z")) { + /* + * XXX: We are running in "decompress" mode & + * filename does not end in ".Z". Try to + * stick a .Z extension to it, and attempt to + * decompress that file instead. This can + * cause existing files to be overwritten if + * `*argv' happens to be a real file, so we + * should check with stat() here to see if the + * file `*argv' exists already, and avoid + * overwriting it in decompress() if and only + * if `*argv' exists AND `newname' does NOT + * exist at the same time. + */ if (len > sizeof(newname) - 3) { cwarnx("%s: name too long", *argv); break; %%% To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030106040312.GA6593>