[Bug 1549850] Re: ncal crashes with segmentation fault

dann frazier dann.frazier at canonical.com
Thu Feb 25 19:34:01 UTC 2016


Thanks for the report. The problem appears to be with how glibc's
nl_langinfo() is returning values on s390x (or, at least, with how ncal
*assumes* it will return them). Here's a short test program:

---
int main() {
  int i = (intptr_t)nl_langinfo(_NL_TIME_WEEK_1STDAY);
  printf("1ST DAY IS %d\n", i);
}
---
On x86, this, for most locales, will output:

$ ./test
1ST DAY IS 19971130

However, on s390x, it outputs:

$ ./test
1ST DAY IS 0

However, if you look at the full pointer, you can see that s390x does
have the correct value in the top order bytes:

ubuntu at s390x:~$ cat test.c
#include <stdio.h>
#include <langinfo.h>
#include <stdint.h>

int main() {
  char *p = nl_langinfo(_NL_TIME_WEEK_1STDAY);
  printf("1ST DAY IS %p\n", p);
}

ubuntu at s390x:~$ gcc test.c -o test
ubuntu at s390x:~$ ./test
1ST DAY IS 0x130bc3a00000000

While on x86/arm64 it is in the lower bytes:
ubuntu at x86$ ./test 
1ST DAY IS 0x130bc3a


** Changed in: glibc (Ubuntu)
     Assignee: (unassigned) => Dimitri John Ledkov (xnox)

** Changed in: bsdmainutils (Ubuntu)
     Assignee: Skipper Bug Screeners (skipper-screen-team) => Dimitri John Ledkov (xnox)

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

Title:
  ncal crashes with segmentation fault

Status in bsdmainutils package in Ubuntu:
  Confirmed
Status in glibc package in Ubuntu:
  New

Bug description:
  == Comment: #0 - Christoph Arenz <arenz at de.ibm.com> - 2016-02-24 09:27:23 ==
  The ncal calendar program crashes with a segmentation fault.

  test at s8315043:~$ ncal
  Segmentation fault (core dumped)

  Note that ncal is a symlink to cal and cal is working fine.

  test at s8315043:~$ ls -l /usr/bin/cal /usr/bin/ncal
  lrwxrwxrwx 1 root root     4 Feb  7 11:08 /usr/bin/cal -> ncal
  -rwxr-xr-x 1 root root 33888 Feb  7 11:08 /usr/bin/ncal

  arenz at oc6366361507:~$ cal
      February 2016   
  Su Mo Tu We Th Fr Sa
      1  2  3  4  5  6
   7  8  9 10 11 12 13
  14 15 16 17 18 19 20
  21 22 23 24 25 26 27
  28 29

  gdb session shows:
  (gdb) run
  Starting program: /usr/bin/ncal 

  Program received signal SIGSEGV, Segmentation fault.
  __wcslen (s=0x0) at wcslen.c:32
  32	wcslen.c: No such file or directory.

  == Comment: #3 - Christoph Arenz <arenz at de.ibm.com> - 2016-02-24 11:52:20 ==
  Package information for ncal/cal:
  test at s8315043:~$ dpkg -l bsdmainutils
  Desired=Unknown/Install/Remove/Purge/Hold
  | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
  ||/ Name                           Version              Architecture         Description
  +++-==============================-====================-====================-==================================================================
  ii  bsdmainutils                   9.0.6ubuntu2         s390x                collection of more utilities from FreeBSD

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



More information about the foundations-bugs mailing list