Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

OpenBSD's patch

by sedusedan (Monk)
on May 26, 2014 at 11:38 UTC ( #1087423=perlquestion: print w/replies, xml ) Need Help??

sedusedan has asked for the wisdom of the Perl Monks concerning the following question:

Probably a bit off-topic here, but I'm curious with OpenBSD's version of the Unix utility 'patch'. My module File::Patch::Undoable is trying to test whether patch supports --dry-run option. OpenBSD's patch does not, but unlike other flavors which also do not support --dry-run (like FreeBSD's), it does not return non-zero exit code when fed unknown option, causing CPANTesters to report lots of errors for my dist (solely on OpenBSD, of course).

Can someone with access to an OpenBSD system help give some idea on identifying this particular flavor? Otherwise, I might as well check for $^O specifically.

Replies are listed 'Best First'.
Re: OpenBSD's patch
by betterworld (Curate) on May 26, 2014 at 13:32 UTC

    I'd try searching for the string "--dry-run" in the output of "patch --help".

    Both "--help" and "--dry-run" are probably GNU specific (GNU uses double dashes). On other systems, "patch --help" will give you error messages, but will never print "--dry-run".

    By the way, according to the man page, OpenBSD's patch program is derived from the one authored by Larry Wall.

      Good idea. I think I'll try this instead of coriac's suggestion of using `man patch` (I'm thinking Windows where there is no 'man' by default). I hope all patch support --help :-)
        I hope all patch support --help

        There are patch programs that don't support help. Again, I am very confident that if it supports "--dry-run", then it will also support "--help".

Re: OpenBSD's patch
by codiac (Beadle) on May 27, 2014 at 09:04 UTC
    Does anyone have patch and not man?
    $res = qx/man patch/; my $dry_option; $dry_option = '--dry-run' if($res =~ /--dry-run/); $dry_option = '--check' if($res =~ /--check/);
      Good idea. I'll give it a try. Thanks!

      There are systems that have multiple "patch" implementations installed. "man" will not always default the the right man page.

Re: OpenBSD's patch
by sedusedan (Monk) on May 26, 2014 at 11:39 UTC

    Also, should I submit a bug report for OpenBSD's patch in relation to this behavior?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1087423]
Approved by taint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2023-02-08 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (42 votes). Check out past polls.

    Notices?