Subject: bin/26732: patch(1) does not work with '-F0' in current
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <oshimaya@sc.starcat.ne.jp>
List: netbsd-bugs
Date: 08/22/2004 14:18:04
>Number: 26732
>Category: bin
>Synopsis: patch(1) does not work with '-F0' in current
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Aug 22 16:45:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Yasushi Oshima
>Release: NetBSD-current 2004-8-17
>Organization:
>Environment:
NetBSD x68030 2.0G NetBSD 2.0G (GENERIC) #1: Fri Aug 17 12:57:42 JST 2004
>Description:
patch(1) does not work with '-F0' or '-p0' flags.
% patch -F0
patch: unrecognized option `-F0'
Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...
Options:
[-ceEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]
[-D symbol] [-Fmax-fuzz] [-o out-file] [-p[strip-count]]
[-r rej-name] [-V {numbered,existing,simple}]
It seems that src/usr.bin/patch.c rev. 1.21 overrun when parsing option flags in get_some_switches().
>How-To-Repeat:
execute patch(1) with '-F0' or '-P0' flag.
>Fix:
diff -u -r1.21 patch.c
--- patch.c 14 Aug 2004 12:53:35 -0000 1.21
+++ patch.c 22 Aug 2004 16:13:55 -0000
@@ -578,7 +578,10 @@
[-r rej-name] [-V {numbered,existing,simple}]\n");
my_exit(1);
}
- opt = *++s;
+ if (*s == '\0')
+ opt = '\0';
+ else
+ opt = *++s;
} while (opt != '\0');
}
}
>Release-Note:
>Audit-Trail:
>Unformatted: