/usr/sbin/update-usbids.sh doesn't handle gzip usb.ids file from http://www.linux-usb.org/usb.ids

Bug #523116 reported by SC
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
usbutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: usbutils

http://www.linux-usb.org/usb.ids returns usb.ids as a gzip file - which the update-usbids.sh cannot handle using grep.

the following revised script will successfully download the usb.ids file:

#!/bin/sh

# see also update-pciids.sh (fancier)

[ "$1" = "-q" ] && quiet="true" || quiet="false"

set -e
SRC="http://www.linux-usb.org/usb.ids"
DEST=/var/lib/misc/usb.ids

# if usb.ids is read-only (because the filesystem is read-only),
# then just skip this whole process.
if ! touch ${DEST} >&2 >/dev/null ; then
        ${quiet} || echo "${DEST} is read-only, exiting."
        exit 0
fi

if which wget >/dev/null 2>&1 ; then
        DL="wget -O $DEST.new.gz $SRC"
        ${quiet} && DL="$DL -q"
elif which lynx >/dev/null 2>&1 ; then
        DL="eval lynx -source $SRC >$DEST.new.gz"
else
        echo >&2 "update-usbids: cannot find wget nor lynx"
        exit 1
fi

if ! $DL ; then
        echo >&2 "update-usbids: download failed"
        rm -f $DEST.new
        exit 1
fi

gunzip $DEST.new.gz

if ! grep >/dev/null "^C " $DEST.new ; then
        echo >&2 "update-usbids: missing class info, probably truncated file"
        exit 1
fi

if [ -f $DEST ] ; then
        mv $DEST $DEST.old
        # --reference is supported only by chmod from GNU file, so let's ignore any errors
        chmod -f --reference=$DEST.old $DEST.new 2>/dev/null || true
fi
mv $DEST.new $DEST

${quiet} || echo "Done."

ProblemType: Bug
Architecture: amd64
Date: Wed Feb 17 23:10:03 2010
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: fglrx
Package: usbutils 0.82-0ubuntu1 [modified: usr/sbin/update-usbids.sh var/lib/misc/usb.ids]
ProcEnviron:
 LANGUAGE=
 LANG=en_NZ.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-19.56-generic
SourcePackage: usbutils
Uname: Linux 2.6.31-19-generic x86_64
XsessionErrors:
 (firefox:10801): GLib-WARNING **: g_set_prgname() called multiple times
 (polkit-gnome-authentication-agent-1:10809): GLib-CRITICAL **: g_once_init_leave: assertion `initialization_value != 0' failed
 (firefox:10846): GLib-WARNING **: g_set_prgname() called multiple times

Revision history for this message
SC (scox-nz) wrote :
Revision history for this message
Hans Spath (h-e0jw7) wrote :

There has been a configuration issue with the linux-usb.org webserver. If you were behind a proxy, it was possible to receive a gzip encoded response even if the client (wget) didn't indicate support for such. The issue has been resolved recently.

See https://sourceforge.net/p/forge/site-support/16108/ for details.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.