** Description changed: + [Impact] + + * Users of tgt who wish to make use of the server command line options: + -d,--debug , -t,--nr_iothreads, -C,--control-port will fail due to + an option parsing error. This prevents users from exercising + additional control of the tgtd, regressing the capabilities of tgtd. + + This affects the 1.0.63 release of tgt and is not yet fixed upstream. + Patches have been sumitted. + + * Backporting fixes from upstream release is required to ensure + users of tgtd can exercise all capabilities, including enabling + debugging and other features previously available to tgt users. + + * The patch fixes a misuderstanding of the use of errno after calling + the strtoull libc call. Errno is not set in all cases for strtoull + so extra checks must be used to determine if the current value of + errno is related to the strtoull call. + + [Test Case] + + * On a Xenial 16.04 system + 1. lxd init + 2. lxc launch ubuntu-daily:xenial x1 + 3. lxc exec x1 -- /bin/bash -c 'apt-get update && apt-get -y install tgt && tgtd -d1; echo $?' + + # On FAILURE: return code will be non-zero with the following output + + -d argument value '1' invalid + Try `tgtd --help' for more information. + 22 + + # After installing the newer tgt package, return code will be 0 + + [Regression Potential] + + * Unlikely any new regressions will take place as the current package + prevents users from using portions of tgtd due to not being able to + pass numeric values to tgtd options. + + [Other Info] + * Debian Bug filed: + - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=822160 + * Upstream request to accept patch + - http://article.gmane.org/gmane.linux.stgt/535 + + + [Original Description] tgt-1:1.0.62-1ubuntu2 # ./tgtd -d 1 -d argument value '1' invalid Try `tgtd --help' for more information. - The following change should fix the problem: --- util.h.old 2015-12-02 03:27:15.000000000 +0300 +++ util.h 2016-02-18 18:04:08.749932076 +0300 @@ -148,7 +148,7 @@ - unsigned long long ull_val; \ - ull_val = strtoull(str, &ptr, 0); \ - val = (typeof(val)) ull_val; \ + unsigned long long ull_val; \ + ull_val = strtoull(str, &ptr, 0); \ + val = (typeof(val)) ull_val; \ - if (errno || ptr == str) \ + if (ull_val == ULONG_MAX || ptr == str) \ - ret = EINVAL; \ - else if (val != ull_val) \ - ret = ERANGE; \ - + ret = EINVAL; \ + else if (val != ull_val) \ + ret = ERANGE; \ Here, the errno is checked incorrectly: you can't check errno unless the returned value allows you to. In case of strtoull(), errno should be checked only if ULONG_MAX is returned. I however can't test the fix properly because when compiled from source, the bug doesn't happen. The value of errno is unspecified, and it just happens to be 0 when I compile from sources.
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1547060 Title: cant use -d switch To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/tgt/+bug/1547060/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
