From owner-freebsd-bugs Sat Mar 18 12: 0: 9 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 0953437BB78 for ; Sat, 18 Mar 2000 12:00:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id MAA84013; Sat, 18 Mar 2000 12:00:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from spock.org (cm-24-161-8-2.nycap.rr.com [24.161.8.2]) by hub.freebsd.org (Postfix) with ESMTP id EC6E937B609 for ; Sat, 18 Mar 2000 11:52:54 -0800 (PST) (envelope-from jon@spock.org) Received: (from jon@localhost) by spock.org serial EF600Q3T-B7F; Sat, 18 Mar 2000 14:52:53 -0500 (EST) (envelope-from jon) Message-Id: <200003181952.OAA46459@spock.org> Date: Sat, 18 Mar 2000 14:52:53 -0500 (EST) From: Jonathan Chen Reply-To: jon@spock.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/17476: uudecode -i (no overwrite) flag bogus Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 17476 >Category: bin >Synopsis: uudecode -i (no overwrite) flag bogus >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 18 12:00:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Jonathan Chen >Release: All releases since 2.2 >Organization: >Environment: >Description: The -i flag in uudecode has no effect except for printing "not overwritten". It overwrites the file anyway. This problem existed since the introduction of the -i flag in uudecode. >How-To-Repeat: uudecode foo < somefile > foo.uu touch foo uudecode -i foo.uu (uudecode will now tell you "foo" was not overwritten, but overwrite it anyway) >Fix: recommend the following patch: (should work on -STABLE and -CURRENT) --- uudecode.c~ Sat Mar 18 14:50:48 2000 +++ uudecode.c Sat Mar 18 14:51:16 2000 @@ -197,9 +197,10 @@ ; /* print to stdout */ else { - if (iflag && !access(buf, F_OK)) + if (iflag && !access(buf, F_OK)) { (void)fprintf(stderr, "not overwritten: %s\n", buf); - if (!freopen(buf, "w", stdout) || + freopen("/dev/null", "w", stdout); + } else if (!freopen(buf, "w", stdout) || fchmod(fileno(stdout), mode&0666)) { warn("%s: %s", buf, filename); return(1); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message