1742492810.FILE5_46-70-g4e2c7d3d.fix-msdosdate-endianess.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Subject: Fix msdosdate endianness
  2. Origin: upstream, commit FILE5_46-70-g4e2c7d3d <https://github.com/file/file/commit/FILE5_46-70-g4e2c7d3d>
  3. Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Thu Mar 20 17:46:50 2025 +0000
  5. Bug-Debian: https://bugs.debian.org/1100712
  6. - fix msdosdate endianness
  7. - remove day of the week as some platforms miscalculate it.
  8. (Christoph Biedl)
  9. FIXME:
  10. - Adjust subject and patch file name
  11. --- a/src/print.c
  12. +++ b/src/print.c
  13. @@ -354,7 +354,7 @@
  14. tm.tm_mon = ((v >> 5) & 0xf) - 1;
  15. tm.tm_year = (v >> 9) + 80;
  16. - if (strftime(buf, bsize, "%a, %b %d %Y", &tm) == 0)
  17. + if (strftime(buf, bsize, "%b %d %Y", &tm) == 0)
  18. goto out;
  19. return buf;
  20. --- a/src/softmagic.c
  21. +++ b/src/softmagic.c
  22. @@ -1042,6 +1042,14 @@
  23. return FILE_LEDOUBLE;
  24. case FILE_LEDOUBLE:
  25. return FILE_BEDOUBLE;
  26. + case FILE_BEMSDOSDATE:
  27. + return FILE_LEMSDOSDATE;
  28. + case FILE_LEMSDOSDATE:
  29. + return FILE_BEMSDOSDATE;
  30. + case FILE_BEMSDOSTIME:
  31. + return FILE_LEMSDOSTIME;
  32. + case FILE_LEMSDOSTIME:
  33. + return FILE_BEMSDOSTIME;
  34. default:
  35. return type;
  36. }
  37. @@ -1159,11 +1167,7 @@
  38. return 1;
  39. case FILE_SHORT:
  40. case FILE_MSDOSDATE:
  41. - case FILE_LEMSDOSDATE:
  42. - case FILE_BEMSDOSDATE:
  43. case FILE_MSDOSTIME:
  44. - case FILE_LEMSDOSTIME:
  45. - case FILE_BEMSDOSTIME:
  46. if (cvt_16(p, m) == -1)
  47. goto out;
  48. return 1;
  49. @@ -1217,6 +1221,8 @@
  50. return 1;
  51. }
  52. case FILE_BESHORT:
  53. + case FILE_BEMSDOSDATE:
  54. + case FILE_BEMSDOSTIME:
  55. p->h = CAST(short, BE16(p->hs));
  56. if (cvt_16(p, m) == -1)
  57. goto out;
  58. @@ -1237,6 +1243,8 @@
  59. goto out;
  60. return 1;
  61. case FILE_LESHORT:
  62. + case FILE_LEMSDOSDATE:
  63. + case FILE_LEMSDOSTIME:
  64. p->h = CAST(short, LE16(p->hs));
  65. if (cvt_16(p, m) == -1)
  66. goto out;