retitle 226210 xserver-xfree86: [debconfage rewrite] mouse port/protocol question priorities too high when autodetected
thanks
On Sun, Jan 04, 2004 at 05:40:56PM -0500, Joey Hess wrote:
> Package: xserver-xfree86
> Version: 4.2.1-14
> Severity: normal
>
> mdetect is easily able to detect the internal ps2 pointing device on my
> LC2000 laptop. It reports:
>
> /dev/psaux
> psaux
>
> Despite the availability of this information, xserver-xfree86's
> configure script persists in prompting for the mouse port, at an
> inflated debconf priority (high). The priority should be low, as there
> is a reasonable default value.
Hmm. I thought I did this.
Actually, I do. Except I'm asking at medium, not high. It's a "normal
item that has a reasonable default" (see debconf-devel(7)). A correct
answer is important for the user to have a good computing experience, so
it cannot be low priority ("Very trivial items that have defaults that
will work in the vast majority of cases; only control freaks see
these.").
Perhaps you can help me find the bug in the following:
738 # mouse device detection
739
740 # priority of xserver-xfree86/config/inputdevice/mouse/{port,protocol}
741 PRIORITY=high
742 AUTODETECTED_PORT=
743 AUTODETECTED_PROTOCOL=
744
745 # determine if we're using devfs
746 if [ -c /dev/.devfsd ]; then
747 USING_DEVFS=true
748 else
749 USING_DEVFS=
750 fi
751
752 if [ -n "$USING_DEVFS" ]; then
753 MOUSE_PORT_CHOICES="/dev/misc/psaux, /dev/tts/0, /dev/tts/1, /dev/tts/2, /dev/tts/3, /dev/input/mice, /dev/misc/atixl, /dev/gpmdata"
754 DEFAULT_PORT="/dev/misc/psaux"
755 else
756 MOUSE_PORT_CHOICES="/dev/psaux, /dev/ttyS0, /dev/ttyS1, /dev/ttyS2, /dev/ttyS3, /dev/input/mice, /dev/atibm, /dev/sunmouse, /dev/gpmdata"
757 DEFAULT_PORT="/dev/psaux"
758 fi
759
760 # if configuring for the first time, ask if user wants to autodetect
761 if [ -z "$RECONFIGURE" ]; then
762 while :; do
763 # bail out if autodetection tool not available
764 which mdetect > /dev/null 2>&1 || break
765 auto_answer db_input "$(priority_ceil $PRIORITY)" xserver-xfree86/autodetect_mouse "false"
766 db_get xserver-xfree86/autodetect_mouse
767 if [ "$RET" = "true" ]; then
768 set +e
769 MDETECT_OUTPUT=$(mdetect -x)
770 set -e
771 if [ -n "$MDETECT_OUTPUT" ]; then
772 if [ $(echo "$MDETECT_OUTPUT" | wc -l) -ne 2 ]; then
773 debug_echo "bug in mdetect; did not return two lines of output"
774 break
775 fi
776 AUTODETECTED_PORT=$(echo "$MDETECT_OUTPUT" | head -n 1)
777 AUTODETECTED_PROTOCOL=$(echo "$MDETECT_OUTPUT" | tail -n 1)
778 debug_echo "mdetect returned port \"$AUTODETECTED_PORT\"; protocol \"$AUTODETECTED_PROTOCOL\""
779 if [ -n "$AUTODETECTED_PORT" ]; then
780 # /dev/input/mouse* means we autodetected a USB pointer; we will
781 # store /dev/input/mice instead.
782 if expr "$AUTODETECTED_PORT" : "/dev/input/mouse.*" > /dev/null 2>&1; then
783 AUTODETECTED_PORT="/dev/input/mice"
784 fi
785 else
786 debug_echo "bug in mdetect: returned nothing for mouse port"
787 break
788 fi
789 if [ -z "$AUTODETECTED_PROTOCOL" ]; then
790 debug_echo "bug in mdetect: returned nothing for mouse protocol"
791 break
792 fi
793 else
794 debug_echo "mdetect returned no output; unable to autodetect mouse"
795 # permit user to retry, but set to false in the case question doesn't
796 # get asked (for noninteractive configuration)
797 db_set xserver-xfree86/autodetect_mouse "false"
798 fi
799 if [ -n "$AUTODETECTED_PORT" -a -n "$AUTODETECTED_PROTOCOL" ]; then
800 PRIORITY=medium
801 break # port and protocol determined
802 fi
803 else
804 debug_echo "user declined mouse autodetection"
805 break # bail out; autodetection not desired
806 fi
807 done
808 else
809 debug_echo "not prompting for mouse autodetection; reconfiguring"
810 fi
811
812 db_subst xserver-xfree86/config/inputdevice/mouse/port choices $MOUSE_PORT_CHOICES
813 auto_answer db_input "$(priority_ceil $PRIORITY)" xserver-xfree86/config/inputdevice/mouse/port "${AUTODETECTED_PORT:-$DEFAULT_PORT}"
> It also neglects to select the /dev/psaux item in the debconf question
> about the mouse port. This is not obvious if the dialog frontend is
> used, since "/dev/psaux" happens to be at the top of the list and so is
> the implicit default, but in the text frontend, there is no default
> selected.
See my reply to another recent bug of yours regarding autoconfiguration
vs. template defaults. I had a bitch of a time getting that right[1].
I think it had to do with the fact that I can't program a default
dynamically, and pre-*answering* the question (which changes the
default) is not the right thing to do.
[1] You don't have to tell me you don't think I did get it right; I
already know.
--
G. Branden Robinson | The basic test of freedom is
Debian GNU/Linux | perhaps less in what we are free to
branden@debian.org | do than in what we are free not to
http://people.debian.org/~branden/ | do. -- Eric Hoffer
Attachment:
signature.asc
Description: Digital signature