bug-wget
[Top][All Lists]
Advanced

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

[bug #60142] if stylesheet filename differs only after ~200 chars, the l


From: anonymous
Subject: [bug #60142] if stylesheet filename differs only after ~200 chars, the last overwrites all previous and convert-links fails
Date: Sun, 28 Feb 2021 13:11:36 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0

URL:
  <https://savannah.gnu.org/bugs/?60142>

                 Summary: if stylesheet filename differs only after ~200
chars, the last overwrites all previous and convert-links fails
                 Project: GNU Wget
            Submitted by: None
            Submitted on: Sun 28 Feb 2021 06:11:34 PM UTC
                Category: Program Logic
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Florian Rosenauer
        Originator Email: rosenauer@gmx.net
             Open/Closed: Open
                 Release: trunk
         Discussion Lock: Any
        Operating System: Microsoft Windows
         Reproducibility: Every Time
           Fixed Release: None
         Planned Release: None
              Regression: None
           Work Required: None
          Patch Included: None

    _______________________________________________________

Details:

I stumbled upon a bug when downloading the Wiki from
https://xwing-miniatures.fandom.com/wiki/X-Wing_Miniatures_Wiki as there were
much more stylesheets in the original webpage than on the local directory, and
it is really easy to reproduce. The problem is, that MediaWiki or at least the
implementation at fandom.com uses ONE stylesheet generator which takes all
stylesheets as parameter and delivers a ONE-IN-ALL stylesheet. This exceeds
~200 chars, and then gets truncated by wget. However, there are several
stylesheets which differ only after these ~200 chars. So wget link-replaces
only the last of these stylesheets. The more files you download, the more
likely this problem happens. Unfortunatelly as the most important central
stylesheet is missing due to that, the pages render completely unusable for
local use in the Browser.

= To reproduce: =
== 1. create a file wget-test.html on your php enabled webserver with this
content: ==
<html>
<head>
<title>wget bug demo</title>
<link rel="stylesheet"
href="wget-stylesheet.php?v=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890xA"/>
<link rel="stylesheet"
href="wget-stylesheet.php?v=1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890x1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890xB"/>
</head>
<body>
    Hello amazing wget developers!
</body>
</html>

== 2. create a file wget-stylesheet.php with the following content: ==
<?php
/* irl this would generate a CSS based on the parameters */
echo '//v=' . htmlspecialchars($_GET["v"]);
?>

p { }
body{
    color: red;
}

== 3. run this command: ==
wget --recursive --no-clobber --page-requisites --html-extension
--convert-links --restrict-file-names=windows --span-hosts
http://localhost/wget-test/wget-test.html ==

== Expected result: ==
three files downloaded, three files on disk, and all two <link
rel="stylesheet" href="..."/> replaced.

== Real result: ==
three files downloaded, but only two on the disk, and only the second <link
rel="stylesheet" href="..."/> is replaced with the local file. 

== Version Information == 
$ wget -V
GNU Wget 1.21.1 built on cygwin.

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

Wgetrc:
    /etc/wgetrc (system)
Locale:
    /usr/share/locale
Compile:
    gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/etc/wgetrc"
    -DLOCALEDIR="/usr/share/locale" -I.
    -I/home/BWI/src/cygwin/wget/wget-1.21.1-1.x86_64/src/wget-1.21.1/src
    -I../lib
    -I/home/BWI/src/cygwin/wget/wget-1.21.1-1.x86_64/src/wget-1.21.1/lib
    -I/usr/include/uuid -DNDEBUG -ggdb -O2 -pipe -Wall
    -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
    -fstack-protector-strong --param=ssp-buffer-size=4
   
-fdebug-prefix-map=/home/BWI/src/cygwin/wget/wget-1.21.1-1.x86_64/build=/usr/src/debug/wget-1.21.1-1
   
-fdebug-prefix-map=/home/BWI/src/cygwin/wget/wget-1.21.1-1.x86_64/src/wget-1.21.1=/usr/src/debug/wget-1.21.1-1
Link:
    gcc -I/usr/include/uuid -DNDEBUG -ggdb -O2 -pipe -Wall
    -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
    -fstack-protector-strong --param=ssp-buffer-size=4
   
-fdebug-prefix-map=/home/BWI/src/cygwin/wget/wget-1.21.1-1.x86_64/build=/usr/src/debug/wget-1.21.1-1
   
-fdebug-prefix-map=/home/BWI/src/cygwin/wget/wget-1.21.1-1.x86_64/src/wget-1.21.1=/usr/src/debug/wget-1.21.1-1
    -lmetalink -lcares -lpcre2-8 -luuid -lidn2 -lnettle -lgnutls -lz
    -lpsl -lgpgme ftp-opie.o gnutls.o http-ntlm.o ../lib/libgnu.a
    -liconv -lintl -lunistring

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>.



Thank you for the great work on wget!



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 28 Feb 2021 06:11:34 PM UTC  Name: wget-stylesheet.php  Size: 151B  
By: None

<http://savannah.gnu.org/bugs/download.php?file_id=50946>
-------------------------------------------------------
Date: Sun 28 Feb 2021 06:11:34 PM UTC  Name: wget-test.html  Size: 832B   By:
None

<http://savannah.gnu.org/bugs/download.php?file_id=50947>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60142>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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