On Thu, 25 Feb 2016 13:29:07 +0100
v4hn <me_AT_v4hn.de> wrote:
> On Thu, Feb 25, 2016 at 11:24:25AM +0000, Dimitris
> Papastamos wrote:
> > On Wed, Feb 24, 2016 at 08:54:13PM +0100, Mattias
> > Andrée wrote:
> > > I'm thinking about introducing an extension to the
> > > standard: -w. When this flag is used, patch will
> > > verify that the patchfile only changes whitespace in
> > > the file.
> > >
> > > 1) Do you think this should be a flag or a separate
> > > tool?
> >
> > Sounds like it could be a flag.
>
> Sounds useless to me. What counts as whitespace change?
> `if(x){ \n` -> `if(x){\n`, ok,
> `\tif(x){\n` -> ` if(x){\n`, in python and haskell
> probably not, `if(x){\n` -> `if(x) {\n`, seems simple
> enough, `printf("%d",x);\n` -> `printf("% d",x);\n`,
> that's no simple whitespace change, not to talk about the
> infamous bumblebee patch `rm -rf /usr /share` -> `rm
> -rf /usr/share`
>
> This does not belong into standard patch.
I think the documentation should be clear that it
only to be relied upon if whitespace changes do
not have any affects. Perhaps it should not allow
introducing whitespace where there was none,
-helloworld
+hello world
or removing all whitespace
-hello world !
+helloworld !
to protect against changes in strings. This however
does would mean that
-a=b*c
+a = b * c
would not be allowed either.
>
> > > 2) Should it be able to do a dry run, would be
> > > another flag that can be used independently of -w?
> >
> > Yes it would be nice to support a dry run flag
> > regardless of whether -w is specified or not.
>
> gnu patch supports --dry-run. It probably makes sense
> to support this flag either way.
>
>
> v4hn
Received on Thu Feb 25 2016 - 13:39:30 CET