Author: branden Date: 2004-08-31 18:45:40 -0500 (Tue, 31 Aug 2004) New Revision: 1781
Modified: branches/debconf-overhaul/debian/CHANGESETS branches/debconf-overhaul/debian/TODO branches/debconf-overhaul/debian/changelog branches/debconf-overhaul/debian/xserver-xfree86.config.in Log: Accept comma-delimited list of values and/or ranges when validating monitor frequencies (fixes regression on trunk). Accept (optional) units (Hz, kHz, MHz) per the XF86Config-4(5x) manual page when validating monitor frequencies, which we never did before. Modified: branches/debconf-overhaul/debian/CHANGESETS =================================================================== --- branches/debconf-overhaul/debian/CHANGESETS 2004-08-31 22:26:23 UTC (rev 1780) +++ branches/debconf-overhaul/debian/CHANGESETS 2004-08-31 23:45:40 UTC (rev 1781) @@ -491,8 +491,9 @@ Make xserver-xfree86 config script's validate_monitor_frequency_db_input() function more strict, so it doesn't regard open-ended ranges like "40-" as -valid. - 1766, 1769, 1772 +valid. Also accept (optional) units (Hz, kHz, MHz) per the +XF86Config-4(5x) manual page, which we never did before. + 1766, 1769, 1772, [XXX: ADD REVISION NUMBER WHEN MERGED TO TRUNK] Grab from XFree86 CVS (2003-12-18) several fixes for keyboard issues: + Fix for XKB map 'altwin' to avoid one keysym to more than one modifier @@ -580,6 +581,6 @@ modules to load. Add description of this module to xserver-xfree86/config/modules template description. Refer to XVideo extension as such instead of "Xv". (Closes: #135768) - [XXX: REPLACE WITH REVISION NUMBER WHEN MERGED TO TRUNK] + [XXX: REPLACE WITH REVISION NUMBER WHEN MERGED TO TRUNK] vim:set ai et sts=4 sw=4 tw=80: Modified: branches/debconf-overhaul/debian/TODO =================================================================== --- branches/debconf-overhaul/debian/TODO 2004-08-31 22:26:23 UTC (rev 1780) +++ branches/debconf-overhaul/debian/TODO 2004-08-31 23:45:40 UTC (rev 1781) @@ -37,8 +37,6 @@ not confused with being in the imperative voice. + Migrate users of 4.3.0.dfsg.1-6 and previous to automatically add v4l to module list. - + Accept comma-delimited list of values and/or ranges when validating monitor - frequencies. * Add FAQ entry describing Debian's plans in the X department. 4.3.0.dfsg.1-8 Modified: branches/debconf-overhaul/debian/changelog =================================================================== --- branches/debconf-overhaul/debian/changelog 2004-08-31 22:26:23 UTC (rev 1780) +++ branches/debconf-overhaul/debian/changelog 2004-08-31 23:45:40 UTC (rev 1781) @@ -493,7 +493,8 @@ * Make xserver-xfree86 config script's validate_monitor_frequency_db_input() function more strict, so it doesn't regard open-ended ranges like "40-" as - valid. + valid. Also accept (optional) units (Hz, kHz, MHz) per the + XF86Config-4(5x) manual page, which we never did before. Changes by Robert Millan: @@ -527,7 +528,7 @@ missing to enable this feature. No keymaps currently use this feature, but users may find it useful with broken keymaps. - -- Branden Robinson <[EMAIL PROTECTED]> Tue, 31 Aug 2004 17:21:40 -0500 + -- Branden Robinson <[EMAIL PROTECTED]> Tue, 31 Aug 2004 18:40:15 -0500 xfree86 (4.3.0.dfsg.1-6) unstable; urgency=low Modified: branches/debconf-overhaul/debian/xserver-xfree86.config.in =================================================================== --- branches/debconf-overhaul/debian/xserver-xfree86.config.in 2004-08-31 22:26:23 UTC (rev 1780) +++ branches/debconf-overhaul/debian/xserver-xfree86.config.in 2004-08-31 23:45:40 UTC (rev 1781) @@ -252,10 +252,44 @@ set -e } +validate_monitor_frequency_expr () { + # Syntax: validate_monitor_frequency_expr expression + # + # Confirm that the given expression is a valid monitor frequency expression + # per XF86Config-4(5x). Note that this does *not* handle (comma-delimited) + # tuples. We expect a single value or range with an optional unit suffix. + # + # Note: We don't check to see if the latter value in a range is actually + # greater than the former, and we don't check to see if any of the numeric + # values actually make sense. I.e., 0 Hz may not actually be valid as far as + # the X server is concerned, but 10000 Hz might be okay whereas 10000 kHz + # might not be. It would take quite a bit of code to sort all that out. We + # only take some of the bullets out of the user's gun -- not all of them. + # + # Return true (0) if the expression is valid, and false (1) if it is not. + + local regex + regex='^[[:space:]]*0*[0-9]+(\.[0-9]+)?(-0*[0-9]+(\.[0-9]+)?)?([[:space:]]*[kM]?Hz)?$' + + if [ $# -ne 1 ]; then + internal_error "validate_monitor_frequency_expr() called with wrong" \ + "number of arguments: $*" + fi + + if echo "$1" | grep -Eiq "$regex"; then + return 0 + else + return 1 + fi +} + validate_monitor_frequency_db_input () { # Syntax: validate_monitor_frequency_db_input priority template # # validate monitor frequency input + + local valid freq_expr + if [ $# -ne 2 ]; then internal_error "validate_monitor_frequency_db_input() called with wrong" \ "number of arguments: $*" @@ -276,11 +310,24 @@ # This is a string, and needs input validation; a regex match will have to # do. We force the first character to be a number to avoid hideous problems # in the debconf dialog frontend in 0.3.83 (it needs to be one anyway). We - # don't allow values less than 10. - if echo "$RET" | grep -qE \ - '^[0-9]{2,3}(\.[0-9]+)?(-[0-9]{2,3}(\.[0-9]+)?)?$'; then - break # valid input + # need to handle multiple expressions, delimited by commas. See + # XF86Config-4(5x) for more information. + if expr "$RET" : ".*,.*" >/dev/null 2>&1; then + valid=true + echo "$RET" | tr -s ',' '\n' | while read freq_expr; do + if ! validate_monitor_frequency_expr "$freq_expr"; then + valid= + fi + done + if [ -n "$valid" ]; then + break + fi + else + if validate_monitor_frequency_expr "$RET"; then + break + fi fi + # we only get to this point if the input was invalid; restore the known # good value in case we are interrupted before the user provides a # valid one