On Wed, Apr 11, 2012 at 03:49:26AM +0200, Cyril Brulebois wrote: > > Please find attached a proposed diff (generated using interdiff) with the > > fixes that would be included in the new package. The code is also available > > in the Squeeze branch of netselect's SVN repository at svn.debian.org [1] > > Minor nits below. Sorry fo the late response. Attached is a reviewed diff fixing the issues spotted. Fixes are already in SVN both for squeeze and for sid, although I have not uploaded a new sid package (will wait for some other bug fixes before I do). Regards Javier
diff -u netselect-0.3.ds1/netselect-apt netselect-0.3.ds1/netselect-apt
--- netselect-0.3.ds1/netselect-apt
+++ netselect-0.3.ds1/netselect-apt
@@ -5,6 +5,7 @@
#
# Author: Avery Pennarun <apenwarr@debian.org>
# Enhancements: Filippo Giunchedi <filippo@esaurito.net>
+# Javier Fernandez-Sanguino <jfs@debian.org>
#
# License: public domain. Please feel free to improve this script. It
# doesn't really belong in the netselect package, particularly since the
@@ -49,18 +50,20 @@
{
SEARCH="$1"
PROTO="$2"
- out=$(netselect -v -s 1 $(cat "$infile" \
+ hosts=$(cat "$infile" \
| perl -n -e '
$/="<br><br>";
while(<>){
next if $_ !~ /Site:/;
if( ( /Includes architectures:.+'"$arch"'.+/i ||
$_ !~ /Includes architectures:/ ) &&
- m@<br>'"$SEARCH"':.*<a href="('"$PROTO"'://.*?)">@i
+ m@<br>'"$SEARCH"':.*<a.*?href="('"$PROTO"'://.*?)">@i
){
print("$1\n");
}
- }'))
+ }')
+ [ -z "$hosts" ] && return 200
+ out=`netselect -v -s 1 $hosts`
rv=$?
echo $out | awk '{print $2}'
return $rv
@@ -78,6 +81,23 @@
log "most likely you don't have enough permission."
}
+netselect_parse_error()
+{
+ log "netselect-apt was unable to obtain a list of valid hosts from"
+ if [ "$tmpinfile" = "0" ] ;then
+ log "the file provided ($infile)."
+ else
+ log "the file downloaded from the url '$url'."
+ fi
+ log "This might happen because of any of the following reasons: "
+ log " - there was an error in the file "
+ log " - the file is not in the format netselect-apt expected "
+ log " - there is a bug in netselect-apt "
+ log "Please manually check the file. If you believe its contents are correct, file "
+ log "a bug (hint: use 'reportbug') against netselect-apt and provide the file as "
+ log "well as the output generated by the program (hint: use 'script')."
+}
+
usage()
{
log "Usage: netselect-apt [OPTIONS] [ debian_release ]"
@@ -164,6 +184,9 @@
elif [ $netselect_rv -eq 6 ]; then
netselect_permission_error
exit 2
+elif [ $netselect_rv -eq 200 ]; then
+ netselect_parse_error
+ exit 2
else
netselect_generic_error
exit 2
diff -u netselect-0.3.ds1/netselect-apt.1 netselect-0.3.ds1/netselect-apt.1
--- netselect-0.3.ds1/netselect-apt.1
+++ netselect-0.3.ds1/netselect-apt.1
@@ -23,6 +23,15 @@
The output file is written to
.IR OUTFILE .
+If
+.BR netselect
+is not installed setuid, then
+.BR netselect-apt
+needs to run as an administrator user (i.e. root). This is only required
+because the network probes done by
+.BR netselect
+requires these permissions. No changes are done to the system.
+
If
.BI "\-i" " INFILE"
is passed
@@ -78,8 +87,37 @@
+.SH LIMITATIONS
+.BR netselect-apt
+is unable to work with restricted environments in which network filtering is
+implemented as it relies on
+.BR netselect
+being able to find a suitable mirror. To do this, the system where the script is run
+needs to have network visibility of the mirrors, as it will probe them using UDP probes.
+
+.BR netselect-apt
+is also unable to work in environments where HTTP or FTP network connections have to be
+done through a proxy host, as it relies on being able to test the validity of the
+remote mirrors doing direct network connections to them.
+
+.BR netselect-apt
+will not check if the mirror it suggests as the "fastest" mirror is either valid or
+up-to-date. It is recommended that users that use this tool also validate that the
+mirrors suggested are official mirrors and are also current.
+
+
.SH SEE ALSO
.BR netselect (1),
.BR wget (1),
+.BR curl (1),
.BR apt (8),
.IR sources.list (5).
+For Debian GNU/Linux it is recommended that users review the official mirror
+list at http://www.debian.org/mirror/official as well as the mirror checker
+tool at http://mirror.debian.org/status.html (which provides information on the
+up-to-dateness status of mirrors)
+
.SH AUTHOR
-Avery Pennarun <apenwarr@nit.ca>
+Avery Pennarun <apenwarr@gmail.com>
+
+This manual page and program have been also enhanced by
+Filippo Giunchedi <filippo@esaurito.net> and Javier Fernandez-Sanguino <jfs@debian.org>
+
diff -u netselect-0.3.ds1/debian/changelog netselect-0.3.ds1/debian/changelog
--- netselect-0.3.ds1/debian/changelog
+++ netselect-0.3.ds1/debian/changelog
@@ -1,3 +1,26 @@
+netselect (0.3.ds1-14+squeeze1) stable; urgency=medium
+
+ * Backport fixes and documentation to Squeeze to fix grave bugs.
+ * netselect-apt:
+ - modify regular expression to parse newest mirrors list with
+ rel="nofollow" in href links. Thanks to "Nameless" for the patch
+ (Closes: #667985, #665876)
+ - Make the script more robust by having it check and detect some common
+ issues when running netselect:
+ * No hosts are found to use with netselect, due to an incorrect file
+ being provided or an error when downloading the mirror list
+ Now the script will at least abort with a (hopefully useful) error
+ message instead of writing a useless sources.list (Closes: #238888)
+ - More verbose output when netselect-apt fails indicating possible causes
+ of errors
+ * netselect-apt.1: Update documentation:
+ - List known limitations of the program
+ - Reference the mirror pages for Debian for more information
+ - Add the Debian maintainers to the author's list
+ * debian/control: Update Homepage address
+
+ -- Javier Fernández-Sanguino Peña <jfs@debian.org> Wed, 11 Apr 2012 02:12:51 +0200
+
netselect (0.3.ds1-14) unstable; urgency=low
* Fix spelling mistake in netselect-apt.1
diff -u netselect-0.3.ds1/debian/control netselect-0.3.ds1/debian/control
--- netselect-0.3.ds1/debian/control
+++ netselect-0.3.ds1/debian/control
@@ -6,7 +6,7 @@
Build-Depends: debhelper (>= 5), po-debconf
VCS-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/netselect/trunk
VCS-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/netselect/trunk
-Homepage: http://alumnit.ca/~apenwarr/netselect/
+Homepage: http://github.com/apenwarr/netselect
Package: netselect
Architecture: any
Attachment:
signature.asc
Description: Digital signature