Hi Wladimir,

Wladimir Mutel wrote:
> in Ubuntu Xenial :
> $ lsb_release -rdc ; echo 1 1 + p q | dc ; echo $?
> Description:    Ubuntu 16.04.4 LTS
> Release:        16.04
> Codename:       xenial
> 2
> 0
> 
> in Ubuntu Bionic :
> $ lsb_release -rdc ; echo 1 1 + p q | dc ; echo $?
> Description:    Ubuntu 18.04.1 LTS
> Release:        18.04
> Codename:       bionic
> 2
> 1
> 
> This change causes some scripts using 'dc' to fail, most importantly,
> 'dphys-swapfile'

Thanks for that bug report. This might be the cause for
https://bugs.debian.org/906767 which I'm currently trying to fix.

> which for some ironic reason uses 'dc' instead of 'echo
> $((...))' for its calculations.

That's upstream's decision. And since I know that upstream also runs
rather old Unices, I assume it's because $(( ... )) might not be
available in all shells. According to
https://en.wikipedia.org/wiki/Comparison_of_command_shells#cite_ref-57
it should though be available in all relevant shells since 1992.

The relevant change in dc seems to be from 1.3 to 1.4:

    Detects and reports on any output errors; exits non-success.

The fix seems simple: Drop the "q":

~ → echo 1 1 + p q | dc ; echo $?
2
1
~ → echo 1 1 + p | dc ; echo $?
2
0

Will have to check if that's indeed the cause for
https://bugs.debian.org/906767, but will do a new upload to Debian
Unstable in either case.

Someone else will need to take care of a regression fix for bionic
though.

                Regards, Axel
-- 
 ,''`.  |  Axel Beckert <a...@debian.org>, https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE


** Tags added: bionic cosmic

** Changed in: dphys-swapfile (Ubuntu)
       Status: New => Confirmed

** Bug watch added: Debian Bug tracker #906767
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906767

** Changed in: dphys-swapfile (Ubuntu)
     Assignee: (unassigned) => Axel Beckert (xtaran)

** Changed in: dphys-swapfile (Ubuntu)
       Status: Confirmed => In Progress

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1788681

Title:
  changed exit code for 'dc' in Ubuntu Bionic

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bc/+bug/1788681/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to