Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paramters '--posix --batch' in FreeBSD failed #401

Closed
RicardoSette opened this issue Mar 28, 2022 · 1 comment
Closed

Paramters '--posix --batch' in FreeBSD failed #401

RicardoSette opened this issue Mar 28, 2022 · 1 comment

Comments

@RicardoSette
Copy link

$patch_options = '--posix --batch';

Hi, in FreeBSD this line causes an error because both parameters are executed inside single quotes, see verbose after "composer update -v":

patch '-p1' '--posix --batch' -d '/usr/local/www/vendor/yiisoft/yii2' < '/usr/local/www/patches/yiisoft-yii2-widgets-pjaxasset-php.patch'
patch: unrecognized option `--posix --batch'

usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory]
             [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count]
             [-r rej-name] [-V t | nil | never | none] [-x number]
             [-z backup-ext] [--posix] [origfile [patchfile]]
       patch <patchfile

Where only the 'batch' parameter would suffice, see a functional example of the command

% patch '-p1' '--batch' -d '/usr/local/www/vendor/yiisoft/yii2' < '/usr/local/www/patches/yiisoft-yii2-widgets-pjaxasset-php.patch'
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- /dev/null
|+++ /widgets/PjaxAsset.php
--------------------------
Patching file widgets/PjaxAsset.php using Plan A...
Patch creates file that already exists, Assuming ReversedHunk #1 succeeded at 19.
done

Both parameters also work, but each must be inside its own single quotes, see example:

% patch '-p1' '--posix' '--batch' -d '/usr/local/www/vendor/yiisoft/yii2' < '/usr/local/www/patches/yiisoft-yii2-widgets-pjaxasset-php.patch'
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- /dev/null
|+++ /widgets/PjaxAsset.php
--------------------------
Patching file widgets/PjaxAsset.php using Plan A...
Patch creates file that already exists, Assuming ReversedUnreversed (or previously applied) patch detected!  Ignoring -R.Hunk #1 succeeded at 19.
done

The important thing is to have only one parameter inside each single quote.

Wrong: '--posix --batch'
Correct: '--posix' '--batch'

@cweagans
Copy link
Owner

cweagans commented Feb 7, 2023

main now has explicit support for BSD patch + escapes params separately.

@cweagans cweagans closed this as completed Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants