iraf-community / iraf-fitsutil

FITS utilities
https://iraf.readthedocs.io/en/latest/tasks/fitsutil
Other
1 stars 1 forks source link

segmentation fault in fgwrite/fgread utilities on armhf Ubuntu #16

Closed vpa1977 closed 3 months ago

vpa1977 commented 3 months ago

Ubuntu recently started to use 64 bit time_t on armhf platform. This causes a segmentation fault in fgwrite/fgread functions[1]:

Program received signal SIGSEGV, Segmentation fault.
0x0040284e in sprintf (__fmt=0x405160 "%d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d", __s=0xfffef18c "2024-04-10T23:34:55")
    at /usr/include/arm-linux-gnueabihf/bits/stdio2.h:30
warning: Source file is more recent than executable.
30    return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
(gdb) where
#0  0x0040284e in sprintf (__fmt=0x405160 "%d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d", __s=0xfffef18c "2024-04-10T23:34:55")
    at /usr/include/arm-linux-gnueabihf/bits/stdio2.h:30
#1  fgfileout (fname=fname@entry=0xfffef77d "pix.fits", out=1, ftype=6, path=path@entry=0x405318 "", level=level@entry=1)
    at fgwrite.c:695
#2  0x00400f7e in main (argc=<optimized out>, argv=<optimized out>) at fgwrite.c:360
(gdb) up
#1  fgfileout (fname=fname@entry=0xfffef77d "pix.fits", out=1, ftype=6, path=path@entry=0x405318 "", level=level@entry=1)
    at fgwrite.c:695
warning: 695    fgwrite.c: No such file or directory
(gdb) print tm
$1 = (struct tm *) 0x0

Structure fheader uses long to represent timestamps causing a failure to obtain the proper timestamp.

[1] https://objectstorage.prodstack5.canonical.com/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842/autopkgtest-noble/noble/armhf/i/iraf-fitsutil/20240408_131637_f974b@/log.gz

olebole commented 3 months ago

Fixed by #17.