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

Latest APK fails with wget "unrecognized option" error #6126

Open
l0b0 opened this issue Jul 3, 2019 · 6 comments
Open

Latest APK fails with wget "unrecognized option" error #6126

l0b0 opened this issue Jul 3, 2019 · 6 comments
Labels
cabal-install: cmd/get re: http-transport Issues with http(s) transport: curl, pwsh, wget, ... type: enhancement

Comments

@l0b0
Copy link

l0b0 commented Jul 3, 2019

Describe the bug

As above.

To Reproduce
Steps to reproduce the behavior:

$ docker run -it docker:stable sh
/ # apk add --no-cache cabal ghc
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/3) Installing gmp (6.1.2-r1)
(2/3) Installing libffi (3.2.1-r6)
(3/3) Installing cabal (2.4.1.0-r0)
Executing busybox-1.30.1-r2.trigger
OK: 36 MiB in 18 packages
/ # cabal v2-install pandoc
dieVerbatim: user error (cabal: '/usr/bin/wget' exited with an error:
/usr/bin/wget: unrecognized option: input-file=-
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document
FILE]
[--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
[-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

--spider Only check URL existence: $? is 0 if exists
-c Continue retrieval of aborted transfer
-q Quiet
-P DIR Save to DIR (default .)
-S Show server response
-T SEC Network read timeout is SEC seconds
-O FILE Save to FILE ('-' for stdout)
-U STR Use STR for User-Agent header
-Y on/off Use proxy
)
/ # cabal --version
cabal-install version 2.4.1.0
compiled using version 2.4.1.0 of the Cabal library 

System informataion

  • Arch Linux
@hvr
Copy link
Member

hvr commented Jul 3, 2019

In other words, cabal needs the real "GNU Wget" and doesn't like the pseudo wget provided by busybox

I'm not sure what we can do here; to some degree I consider this a packaging issue with the APK as the APK doesn't make sure that either curl or a proper wget is in PATH (cabal checks whether curl exists, if not, falls back to checking whether wget exists, and so on...; or you can force a specific HTTP transport via the --http-transport flag/config setting)

@gbaz
Copy link
Collaborator

gbaz commented Jul 3, 2019

Is this an arch issue per-se or can one get the real wget from arch too?

I suppose the one thing we could do is add a check on wget that its the real one and not a substitute, but that does feel like a bit much.

@gbaz
Copy link
Collaborator

gbaz commented Jul 3, 2019

Ah its not arch per-se but Alpine. And it does look from a quick browse that one can install the "real" wget or curl if desired.

@23Skidoo
Copy link
Member

23Skidoo commented Jul 3, 2019

Is there a way to detect that the wget exe we've found is impaired?

@hvr
Copy link
Member

hvr commented Jul 7, 2019

@23Skidoo a simple heuristic would be invoking wget --version and possibly making sure the string "GNU Wget" is included in the output:

$ wget --version
GNU Wget 1.19.4 built on linux-gnu.

-cares +digest -gpgme +https +ipv6 +iri +large-file -metalink +nls 
+ntlm +opie +psl +ssl/openssl 

Wgetrc: 
    /etc/wgetrc (system)
Locale: 
    /usr/share/locale 
Compile: 
    gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc" 
    -DLOCALEDIR="/usr/share/locale" -I. -I../../src -I../lib 
    -I../../lib -Wdate-time -D_FORTIFY_SOURCE=2 -DHAVE_LIBSSL -DNDEBUG 
    -g -O2 -fdebug-prefix-map=/build/wget-Xb5Z7Y/wget-1.19.4=. 
    -fstack-protector-strong -Wformat -Werror=format-security 
    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall 
Link: 
    gcc -DHAVE_LIBSSL -DNDEBUG -g -O2 
    -fdebug-prefix-map=/build/wget-Xb5Z7Y/wget-1.19.4=. 
    -fstack-protector-strong -Wformat -Werror=format-security 
    -DNO_SSLv2 -D_FILE_OFFSET_BITS=64 -g -Wall -Wl,-Bsymbolic-functions 
    -Wl,-z,relro -Wl,-z,now -lpcre -luuid -lidn2 -lssl -lcrypto -lpsl 
    ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a 

Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.

Whereas, for busybox, --version doesn't even seem to exist, and you get a non-zero exitcode with a usage message:

# wget --version
wget: unrecognized option: version
BusyBox v1.27.2 (2017-12-12 10:41:50 GMT) multi-call binary.

Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE]
	[--header 'header: value'] [-Y|--proxy on/off] [-P DIR]
	[-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

	--spider	Only check URL existence: $? is 0 if exists
	-c		Continue retrieval of aborted transfer
	-q		Quiet
	-P DIR		Save to DIR (default .)
	-S    		Show server response
	-T SEC		Network read timeout is SEC seconds
	-O FILE		Save to FILE ('-' for stdout)
	-U STR		Use STR for User-Agent header
	-Y on/off	Use proxy

@rjensen26
Copy link

rjensen26 commented Jun 25, 2020

So for wget version for alpine that is using busybox you have to do the following:

 RUN   apk update \                                                                                                                                                                                                                        
  &&   apk add ca-certificates wget \                                                                                                                                                                                                      
  &&   update-ca-certificates   # This line may not do anything

Reference: Yelp/dumb-init#73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cabal-install: cmd/get re: http-transport Issues with http(s) transport: curl, pwsh, wget, ... type: enhancement
Projects
None yet
Development

No branches or pull requests

6 participants