bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] trouble with URL vs local file names


From: Andrew Cady
Subject: Re: [Bug-wget] trouble with URL vs local file names
Date: Fri, 19 Feb 2010 09:35:40 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Feb 19, 2010 at 10:01:18AM +0100, Tobias Senz wrote:
> On 19.02.2010 00:44, Andrew Cady wrote:
> > I have written a patch for wget which makes this behavior possible.  The
> > very use case that you describe is illustrated in the email to this list
> > which contains the patch:
> > 
> >   http://lists.gnu.org/archive/html/bug-wget/2010-01/msg00021.html

[...]

> Just to verify, and be 110% certain, your additional renaming happens
> AFTER all of the built-in escaping / renaming wget would do without the
> patch?

Well, I just tested, and yes: it turns out the --rename modifies the
output filename after the --restrict-file-names option already has, as
you would prefer.  But actually this isn't vitally important, since it
would be possible to recreate the behavior of --restrict-file-names with
--rename.

> So any "%" from hex escapes could also be filtered?

Yep.  Here's a test command line I just tried:

  $ wget --restrict-file-names=windows --rename 's/%/@/g' 
'jerkface.net/~d/address@hidden|pipe%percent.txt'
  [...] address@hidden@address@hidden saved [0/0]

Here's another one that doesn't use --restrict-file-names:

  $ wget --rename 's/address@hidden|\/:?"*<>]/uc sprintf "@%x", ord $&/ge' 
'jerkface.net/~d/address@hidden|pipe%percent.txt'
  [...] address@hidden@address@hidden saved [0/0]

That version escapes the same characters as --restrict-file-names=windows,
but uses hex codes marked with @, so that you can reliably convert the
filenames back to the originals using another regular expression.

> Sorry, i'm a little bit puzzled this would fix all of my troubles, just
> like that :)

If wget output filenames are the extent of your troubles, your life is
quickly approaching perfection...

> Most recent Cygwin is still on wget-1.11.4 with patch level numero 4.
> Your patch applies directly to Debian 1.12 patch level 1. 

Actually, the version in those debs is:

  GNU Wget 1.12.1-devel (2340fa0d1b78) built on linux-gnu.

That is, one behind the latest version in mercurial.  I just checked,
and the patch applies to the latest version as well.  That is, it
definitely applies to these versions:

  changeset:   2647:14f751f028c2
  tag:         tip
  user:        Paul Townsend <address@hidden>
  date:        Wed Jan 27 10:08:26 2010 -0800
  summary:     Time-measurement fix

  changeset:   2646:2340fa0d1b78
  user:        Micah Cowan <address@hidden>
  date:        Wed Jan 13 20:41:15 2010 -0800
  summary:     Fixed some mixed declarations-and-code.

> So hopefully either TOS (the original source) 1.12 or the old Cygwin
> patched source will do. 
>
> Otherwise i'll have to somehow shove it in manually ? :)) (I'ts been a
> while since my last attempt to compile anything anywhere, can you tell
> ? ;) )

I'm pretty sure it won't apply to 1.12, but that you only have to move
some words around on a split line in the Makefile.am or something like
that.  I'd bet the version from mercurial compiles in cygwin, anyway.

Good luck :)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]