Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing tm_isdst initialization #11

Merged
merged 1 commit into from
Sep 9, 2019
Merged

Add missing tm_isdst initialization #11

merged 1 commit into from
Sep 9, 2019

Conversation

olebole
Copy link
Member

@olebole olebole commented Sep 6, 2019

Forwarded from @aurel32 Debian#939523:

As discussed in Debian#939048, the autopkgtest from iraf-fitsutil fail in a strange way when run with glibc 2.29 instead of glibc 2.28:

cl> fitsutil
This is the initial release of the IRAF FITSUTIL package
to include support for FITS tile compression via 'fpack'.
Please send comments and questions to [email protected].

cl> copy dev$pix.pix pix.pix
cl> copy dev$pix.imh pix.imh
cl> fgwrite "pix.pix pix.imh" pix.fits verb-
cl> mkdir out
cl> cd out
cl> fgread ../pix.fits "" "" verb-
cl> sum32 *
ERROR: No write permission on file (String_File)
   "directory (img, long+) | scan (junk, junk, filsiz)"
      line 42: fitsutil$src/sum32.cl
      called as: `sum32 (input=*)'
      called as: `cl ()'
   "clbye()"
      line 41: fitsutil$fitsutil.cl
      called as: `fitsutil ()'
      called as: `cl ()'
 Error while reading login.cl file - may need to rebuild with mkiraf
 Fatal startup error.  CL dies.

This happens because the error checking in mktime() have been improved in case a non-valid date is provided in the tm struct. More precisely in fgread.c, it should be noted that strptime does NOT setup the tm_isdst of tm struct, which is instead getting a random value from the stack. For this field 0 means no DST, positive value means DST and negative values means that the value should be computed by mktime().

In the iraf-fitsutil, tm_isdst is not known from the file so it should be set to -1, just like it's done in the POSIX.1-2018 strptime example:

https://pubs.opengroup.org/onlinepubs/9699919799/

Therefore the following patch fixes the issue.

Thank you @aurel32 for the quick fix!

As discussed in bug#939048, the autopkgtest from iraf-fitsutil fail in a
strange way when run with glibc 2.29 instead of glibc 2.28:

| cl> fitsutil
| This is the initial release of the IRAF FITSUTIL package
| to include support for FITS tile compression via 'fpack'.
| Please send comments and questions to [email protected].
|
| cl> copy dev$pix.pix pix.pix
| cl> copy dev$pix.imh pix.imh
| cl> fgwrite "pix.pix pix.imh" pix.fits verb-
| cl> mkdir out
| cl> cd out
| cl> fgread ../pix.fits "" "" verb-
| cl> sum32 *
| ERROR: No write permission on file (String_File)
|   "directory (img, long+) | scan (junk, junk, filsiz)"
|      line 42: fitsutil$src/sum32.cl
|      called as: `sum32 (input=*)'
|      called as: `cl ()'
|   "clbye()"
|      line 41: fitsutil$fitsutil.cl
|      called as: `fitsutil ()'
|      called as: `cl ()'
| Error while reading login.cl file - may need to rebuild with mkiraf
| Fatal startup error.  CL dies.

This happens because the error checking in mktime() have been improved
in case a non-valid date is provided in the tm struct. More precisely
in fgread.c, it should be noted that strptime does NOT setup the
tm_isdst of tm struct, which is instead getting a random value from the
stack. For this field 0 means no DST, positive value means DST and
negative values means that the value should be computed by mktime().

In the iraf-fitsutil, tm_isdst is not known from the file so it should
be set to -1, just like it's done in the POSIX.1-2018 strptime example:

https://pubs.opengroup.org/onlinepubs/9699919799/

Therefore the following patch fixes the issue.

Closes: #939523
@olebole olebole merged commit e6f231a into iraf-community:master Sep 9, 2019
@olebole olebole deleted the tm_isdst branch September 9, 2019 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant