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

grep: unrecognized option: P #5105

Closed
Anonym-tsk opened this issue Apr 22, 2024 · 9 comments
Closed

grep: unrecognized option: P #5105

Anonym-tsk opened this issue Apr 22, 2024 · 9 comments

Comments

@Anonym-tsk
Copy link

Grep in BusyBox doesn't support -P argument used in synology_dsm.sh

[Mon Apr 22 14:42:42 MSK 2024] Logging into 192.168.0.150:5001...
grep: unrecognized option: P
BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.

Usage: grep [-HhnlLoqvsrRiwFE] [-m N] [-A|B|C N] { PATTERN | -e PATTERN... | -f FILE... } [FILE]...

Search for PATTERN in FILEs (or stdin)

	-H	Add 'filename:' prefix
	-h	Do not add 'filename:' prefix
	-n	Add 'line_no:' prefix
	-l	Show only names of files that match
	-L	Show only names of files that don't match
	-c	Show only count of matching lines
	-o	Show only the matching part of line
	-q	Quiet. Return 0 if PATTERN is found, 1 otherwise
	-v	Select non-matching lines
	-s	Suppress open and read errors
	-r	Recurse
	-R	Recurse and dereference symlinks
	-i	Ignore case
	-w	Match whole words only
	-x	Match whole lines only
	-F	PATTERN is a literal (not regexp)
	-E	PATTERN is an extended regexp
	-m N	Match up to N times per file
	-A N	Print N lines of trailing context
	-B N	Print N lines of leading context
	-C N	Same as '-A N -B N'
	-e PTRN	Pattern to match
	-f FILE	Read pattern from file
[Mon Apr 22 14:42:42 MSK 2024] Unable to authenticate to https://192.168.0.150:5001, you may report the full log to the community.
[Mon Apr 22 14:42:42 MSK 2024] Error deploy for domain:***.net
[Mon Apr 22 14:42:42 MSK 2024] Deploy error.
[Mon Apr 22 14:42:42 MSK 2024] Error renew ***.net.
[Mon Apr 22 14:42:42 MSK 2024] Sending via: telegram
[Mon Apr 22 14:42:42 MSK 2024] telegram send success.
[Mon Apr 22 14:42:42 MSK 2024] telegram Success
[Mon Apr 22 14:42:42 MSK 2024] ===End cron===

Steps to reproduce

Latest docker container, Synology DSM deploy.
acme.sh --cron --home "/root/.acme.sh" --config-home "/acme.sh" --force

Debug log

acme.sh  --issue .....   --debug 2
Copy link

Please upgrade to the latest code and try again first. Maybe it's already fixed. acme.sh --upgrade If it's still not working, please provide the log with --debug 2, otherwise, nobody can help you.

@thrytis
Copy link

thrytis commented Apr 22, 2024

This looks like the bug was introduced with this commit: feat: more user-friendly logic & error messages, specifically this line:

error_code=$(echo "$response" | grep '"error"' | grep -oP '(?<="code":)\d+')

on lines 202, 234, an 292.

Here is the section with the output with --debug 2

[Mon Apr 22 16:06:18 UTC 2024] SYNO_CERTIFICATE
[Mon Apr 22 16:06:18 UTC 2024] Getting API version...
[Mon Apr 22 16:06:18 UTC 2024] _base_url='https://msfrizzle.lair.spotdog.net:5001/'
[Mon Apr 22 16:06:18 UTC 2024] GET
[Mon Apr 22 16:06:18 UTC 2024] url='https://msfrizzle.lair.spotdog.net:5001/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query&query=SYNO.API.Auth'
[Mon Apr 22 16:06:18 UTC 2024] timeout=
[Mon Apr 22 16:06:18 UTC 2024] _CURL='curl --silent --dump-header /[acme.sh/http.header](http://acme.sh/http.header)  -L  --trace-ascii /tmp/tmp.KRnZ6xdP4Z  -g '
[Mon Apr 22 16:06:18 UTC 2024] ret='0'
[Mon Apr 22 16:06:18 UTC 2024] Logging into msfrizzle.lair.spotdog.net:5001...
grep: unrecognized option: P
BusyBox v1.35.0 (2022-11-19 10:13:10 UTC) multi-call binary.

Usage: grep [-HhnlLoqvsrRiwFE] [-m N] [-A|B|C N] { PATTERN | -e PATTERN... | -f FILE... } [FILE]...

Search for PATTERN in FILEs (or stdin)

	-H	Add 'filename:' prefix
	-h	Do not add 'filename:' prefix
	-n	Add 'line_no:' prefix
	-l	Show only names of files that match
	-L	Show only names of files that don't match
	-c	Show only count of matching lines
	-o	Show only the matching part of line
	-q	Quiet. Return 0 if PATTERN is found, 1 otherwise
	-v	Select non-matching lines
	-s	Suppress open and read errors
	-r	Recurse
	-R	Recurse and dereference symlinks
	-i	Ignore case
	-w	Match whole words only
	-x	Match whole lines only
	-F	PATTERN is a literal (not regexp)
	-E	PATTERN is an extended regexp
	-m N	Match up to N times per file
	-A N	Print N lines of trailing context
	-B N	Print N lines of leading context
	-C N	Same as '-A N -B N'
	-e PTRN	Pattern to match
	-f FILE	Read pattern from file
[Mon Apr 22 16:06:18 UTC 2024] Session ID
[Mon Apr 22 16:06:18 UTC 2024] SynoToken
[Mon Apr 22 16:06:18 UTC 2024] Unable to authenticate to https://msfrizzle.lair.spotdog.net:5001/, you may report the full log to the community.

@alxwolf
Copy link

alxwolf commented Apr 23, 2024

@scruel can you please check your latest commit! it basically broke acme.sh running docker (with busybox) when trying to deploy to DSM

@alxwolf
Copy link

alxwolf commented Apr 23, 2024

@scruel

a working grep line (for busybox, without Perl syntax) should be

error_code=$(echo "$response" | grep -o '"code":[0-9]*' | grep -o '[0-9]*')

to replace code in lines mentioned by @thrytis

@scruel
Copy link
Contributor

scruel commented Apr 24, 2024

@alxwolf Thanks, fixed with your snippet.

@scruel
Copy link
Contributor

scruel commented Apr 26, 2024

acme.sh --upgrade -b dev

@Diluka
Copy link

Diluka commented Apr 28, 2024

acme.sh --upgrade -b dev

it's not working with docker

  1. exec into container
  2. ./entry.sh --upgrade -b dev
  3. it says success
  4. but when deploy, still error

@Neilpang
Copy link
Member

synced to the master branch.
you can use the "latest" tag now.

@svasek
Copy link

svasek commented Apr 30, 2024

synced to the master branch. you can use the "latest" tag now.

Hi @Neilpang,
I can confirm the latest docker image works like a charm.

Thak you!

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

7 participants