Thanks for pointing this out - normally, testing downloading in directories or file-systems without write permission is not on my list :)

The download is superfluous in this case.
But for a recursive download, it needs to be done (wget2 parses HTML in memory).
Instead of '(2)', I'd like to have a more verbose '(2: Permission denied)'.

Regards, Tim

On 10/21/23 20:42, Michael D. Setzer II wrote:
On 21 Oct 2023 at 19:22, Tim Rühsen wrote:
Date sent:Sat, 21 Oct 2023 19:22:25 +0200
Subject:Re: wget claims "Success" when it failed to write to local directory
To:Christian Rosentreter <kar...@gmx.net>, bug-wget@gnu.org
From:Tim Rühsen <tim.rueh...@gmx.de>
Did a test with wget2 and get this result with error (2) if no write permission?
wget2 https://www.christianrosentreter.com/
Failed to open 'index.html' (2)
index.html           100% [=====================================================================>]    1.89K    --.-KB/s                           [Files: 1  Bytes: 1.89K [2.23KB/s] Redirects: 0  Todo: 0  Errors: 0    ]
With write permission it downloads index.html fine.
wget2 https://www.christianrosentreter.com/
index.html           100% [====================================================================>]    1.89K    --.-KB/s                           [Files: 1  Bytes: 1.89K [2.27KB/s] Redirects: 0  Todo: 0  Errors: 0   ]
Hi,

do you run the latest wget (1.21.4)?

With that version, you get a

    Cannot write to 'index.html' (Permission denied).

Regards, Tim

On 10/21/23 17:16, Christian Rosentreter wrote:
> > Hi there, > > There's a minor cosmetic bug in wget 1.x where it claims "Success" when it in fact entirely failed to write to the local
> disk, e.g. because of missing permissions/ write access to the current directory. The 
return code is "3" however, so it's
> basically only the message that it prints on screen that is funny in a 
suspicious way:
> > > ### Prepare situation…
> $ mkdir foobar
> $ chmod -w foobar   # remove write access
> $ cd foobar
> > > ### Note: the "Permission denied" and "Cannot write to" messages, but we
> ###       get a "(Success)" anyway:
> $ wget https://www.christianrosentreter.com/
> --2023-10-21 17:05:35--  https://www.christianrosentreter.com/
> Resolving www.christianrosentreter.com (www.christianrosentreter.com)... 
85.13.142.16
> Connecting to www.christianrosentreter.com 
(www.christianrosentreter.com)|85.13.142.16|:443... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: unspecified [text/html]
> index.html: Permission denied
> > Cannot write to 'index.html' (Success). > > > ### The return code seems to be reasonable though:
> $ echo $?
> 3
> > > ### Version tested:
> $ wget --version
> GNU Wget 1.21.4 built on darwin14.5.0.
> > +cares +digest -gpgme +https +ipv6 +iri +large-file +metalink -nls
> +ntlm +opie +psl +ssl/openssl
> > …cut… > > > > >
+------------------------------------------------------------+
  Michael D. Setzer II - Computer Science Instructor (Retired)
  mailto:mi...@guam.net
  mailto:msetze...@gmail.com
  Guam - Where America's Day Begins
  G4L Disk Imaging Project maintainer
  http://sourceforge.net/projects/g4l/
+------------------------------------------------------------+

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to