Skip to content

Conversation

Piloalucard
Copy link
Member

@Piloalucard Piloalucard commented Aug 1, 2025

Description

GCC __VERSION__ Macro is undefined on the new compilation process in windows, causing crash in binaries

Fixes #534

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have confirmed my fix is effective or that my feature works

@Piloalucard Piloalucard self-assigned this Aug 1, 2025
@Piloalucard
Copy link
Member Author

Piloalucard commented Aug 1, 2025

Regarding crash on binaries on version 2.4.8.0 10517, this is the output when you try to get default help in ltfsck.exe

PS C:\Program Files\IBM\LTFS> .\ltfsck.exe
LTFS9015W Setting the locale to 'en_US.UTF-8'. If this is wrong, please set the LANG environment variable before starting ltfsck.
LTFS16000I Starting ltfsck, SCSILIB version 2.4.8, log level 2.
LTFS16088I Launched by "C:\Program Files\IBM\LTFS\ltfsck.exe".
LTFS16089I This binary is built for Windows.

After changes

ltfsck.exe

PS C:\Program Files\IBM\LTFS> .\ltfsck.exe
LTFS9015W Setting the locale to 'en_US.UTF-8'. If this is wrong, please set the LANG environment variable before starting ltfsck.
LTFS16000I Starting ltfsck, SCSILIB version 2.4.8.1, log level 2.
LTFS16088I Launched by "C:\Program Files\IBM\LTFS\ltfsck.exe".
LTFS16089I This binary is built for Windows.
LTFS16090I GCC version is NA.
LTFS17087I Kernel version: Windows.
LTFS16009E Must provide device name.
LTFS16002E Option validation failed.
Usage: C:\Program Files\IBM\LTFS\ltfsck.exe [options] filesys

filesys                           Device file for the tape drive

Available options are:
  -g, --generation=<generation>   Specify the generation to roll back
  -r, --rollback                  Roll back to the point specified by -g
  -n, --no-rollback               Do not roll back. Verify the point specified by -g (default)
  -f, --full-recovery             Recover extra data blocks into directory _ltfs_lostandfound
  -z, --deep-recovery             Recover EOD missing cartridge.
  -l, --list-rollback-points      List rollback points
  -m, --full-index-info           Display full index information (Effective only for -l option)
  -v, --traverse=<strategy>       Set traverse mode for listing roll back points. Strategy should be forward or backward. (default: backward)
  -j, --erase-history             Erase history at rollback
  -k, --keep-history              Keep history at rollback (default)
  -q, --quiet                     Suppress informational messages
  -t, --trace                     Enable diagnostic output
      --syslogtrace               Enable diagnostic output to stderr and syslog
  -V, --version                   Version information
  -h, --help                      This help
  -p, --advanced-help             Full help, including advanced options

@Piloalucard
Copy link
Member Author

Test on Linux:

[root@atreus ltfs]# mkltfs
LTFS15000I Starting mkltfs, LTFS version 2.4.5.1 (Prelim), log level 2.
LTFS15041I Launched by "mkltfs".
LTFS15042I This binary is built for Linux (x86_64).
LTFS15043I GCC version is 8.5.0 20210514 (Red Hat 8.5.0-23).
LTFS17087I Kernel version: Linux version 4.18.0-553.63.1.el8_10.x86_64 ([email protected]) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-28) (GCC)) #1 SMP Fri Jul 18 06:13:44 EDT 2025 i386.
LTFS17089I Distribution: NAME="Red Hat Enterprise Linux".
LTFS17089I Distribution: Red Hat Enterprise Linux release 8.10 (Ootpa).
LTFS17089I Distribution: Red Hat Enterprise Linux release 8.10 (Ootpa).
LTFS15026E Device name must use the '-d' option.
LTFS15002E Option validation failed.
LTFS17085I Plugin: Loading "sg" tape backend.

Usage: mkltfs <options>

Available options are:
  -d, --device=<name>       Tape device (required)
  -f, --force               Force to format medium
  -s, --tape-serial=<id>    Tape serial number (6 alphanumeric ASCII characters)
  -n, --volume-name=<name>  Tape volume name (empty by default)
  -r, --rules=<rules>       Rules for choosing files to write to the index partition.
                            The syntax of the rule argument is:
                                size=1M
                                size=1M/name=pattern
                                size=1M/name=pattern1:pattern2:pattern3
                            A file is written to the index partition if it is no larger
                            than the given size AND matches at least one of the name
                            patterns (if specified). The size argument accepts K, M, and G
                            suffixes. Name patterns might contain the special characters
                            '?' (match any single character) and '*' (match zero or more
                            characters)
      --no-override         Disallow mount-time data placement policy changes
  -w, --wipe                Restore the LTFS medium to an unpartitioned medium (format to a legacy scratch medium)
  -q, --quiet               Suppress progress information and general messages
  -t, --trace               Enable function call tracing
      --syslogtrace               Enable diagnostic output to stderr and syslog
  -V, --version             Version information
  -h, --help                This help
  -p, --advanced-help       Full help, including advanced options

Usage example:
  mkltfs --device=0 --rules="size=100K"
  mkltfs --device=0 --rules="size=1M/name=*.jpg"
  mkltfs --device=0 --rules="size=1M/name=*.jpg:*.png"
[root@atreus ltfs]# ltfsck
LTFS16000I Starting ltfsck, LTFS version 2.4.5.1 (Prelim), log level 2.
LTFS16088I Launched by "ltfsck".
LTFS16089I This binary is built for Linux (x86_64).
LTFS16090I GCC version is 8.5.0 20210514 (Red Hat 8.5.0-23).
LTFS17087I Kernel version: Linux version 4.18.0-553.63.1.el8_10.x86_64 ([email protected]) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-28) (GCC)) #1 SMP Fri Jul 18 06:13:44 EDT 2025 i386.
LTFS17089I Distribution: NAME="Red Hat Enterprise Linux".
LTFS17089I Distribution: Red Hat Enterprise Linux release 8.10 (Ootpa).
LTFS17089I Distribution: Red Hat Enterprise Linux release 8.10 (Ootpa).
LTFS16009E Must provide device name.
LTFS16002E Option validation failed.
Usage: ltfsck [options] filesys

filesys                           Device file for the tape drive

Available options are:
  -g, --generation=<generation>   Specify the generation to roll back
  -r, --rollback                  Roll back to the point specified by -g
  -n, --no-rollback               Do not roll back. Verify the point specified by -g (default)
  -f, --full-recovery             Recover extra data blocks into directory _ltfs_lostandfound
  -z, --deep-recovery             Recover EOD missing cartridge.
                                  Some blocks might be erased, but recover to final unmount point
                                  with an index version of at least  2.0.0  or earlier.
                                  (Must be used for a cartridge that cannot be recovered by a normal option.)
  -l, --list-rollback-points      List rollback points
  -m, --full-index-info           Display full index information (Effective only for -l option)
  -v, --traverse=<strategy>       Set traverse mode for listing roll back points. Strategy should be forward or backward. (default: backward)
  -j, --erase-history             Erase history at rollback
  -k, --keep-history              Keep history at rollback (default)
  -q, --quiet                     Suppress informational messages
  -t, --trace                     Enable diagnostic output
      --syslogtrace               Enable diagnostic output to stderr and syslog
  -V, --version                   Version information
  -h, --help                      This help
  -p, --advanced-help             Full help, including advanced options

Test on Windows:

PS C:\Program Files\IBM\LTFS> .\mkltfs.exe
LTFS9015W Setting the locale to 'en_US.UTF-8'. If this is wrong, please set the LANG environment variable before starting mkltfs.
LTFS15000I Starting mkltfs, SCSILIB version 2.4.8.1, log level 2.
LTFS15041I Launched by "C:\Program Files\IBM\LTFS\mkltfs.exe".
LTFS15042I This binary is built for Windows.
LTFS15043I MSVC version is 1943.
LTFS17087I Kernel version: Windows.
LTFS15025D Validating command line options.
LTFS15026E Device name must use the '-d' option.
LTFS15002E Option validation failed.
LTFS17085I Plugin: Loading "scsilib" tape backend.

Usage: C:\Program Files\IBM\LTFS\mkltfs.exe <options>

Available options are:
  -d, --device=<name>       Tape device (required)
  -f, --force               Force to format medium
  -s, --tape-serial=<id>    Tape serial number (6 alphanumeric ASCII characters)
  -n, --volume-name=<name>  Tape volume name (empty by default)
  -r, --rules=<rules>       Rules for choosing files to write to the index partition.
                            The syntax of the rule argument is:
                                size=1M
                                size=1M/name=pattern
                                size=1M/name=pattern1:pattern2:pattern3
                            A file is written to the index partition if it is no larger
                            than the given size AND matches at least one of the name
                            patterns (if specified). The size argument accepts K, M, and G
                            suffixes. Name patterns might contain the special characters
                            '?' (match any single character) and '*' (match zero or more
                            characters)
      --no-override         Disallow mount-time data placement policy changes
  -w, --wipe                Restore the LTFS medium to an unpartitioned medium (format to a legacy scratch medium)
  -q, --quiet               Suppress progress information and general messages
  -t, --trace               Enable function call tracing
      --syslogtrace               Enable diagnostic output to stderr and syslog
  -V, --version             Version information
  -h, --help                This help
  -p, --advanced-help       Full help, including advanced options

Usage example:
  C:\Program Files\IBM\LTFS\mkltfs.exe --device=2.0.0.0 --rules="size=100K"
  C:\Program Files\IBM\LTFS\mkltfs.exe --device=2.0.0.0 --rules="size=1M/name=*.jpg"
  C:\Program Files\IBM\LTFS\mkltfs.exe --device=2.0.0.0 --rules="size=1M/name=*.jpg:*.png"
PS C:\Program Files\IBM\LTFS> .\ltfsck.exe
LTFS9015W Setting the locale to 'en_US.UTF-8'. If this is wrong, please set the LANG environment variable before starting ltfsck.
LTFS16000I Starting ltfsck, SCSILIB version 2.4.8.1, log level 2.
LTFS16088I Launched by "C:\Program Files\IBM\LTFS\ltfsck.exe".
LTFS16089I This binary is built for Windows.
LTFS16090I MSVC version is 1943.
LTFS17087I Kernel version: Windows.
LTFS16009E Must provide device name.
LTFS16002E Option validation failed.
Usage: C:\Program Files\IBM\LTFS\ltfsck.exe [options] filesys

filesys                           Device file for the tape drive

Available options are:
  -g, --generation=<generation>   Specify the generation to roll back
  -r, --rollback                  Roll back to the point specified by -g
  -n, --no-rollback               Do not roll back. Verify the point specified by -g (default)
  -f, --full-recovery             Recover extra data blocks into directory _ltfs_lostandfound
  -z, --deep-recovery             Recover EOD missing cartridge.
                                  Some blocks might be erased, but recover to final unmount point
                                  with an index version of at least  2.0.0  or earlier.
                                  (Must be used for a cartridge that cannot be recovered by a normal option.)
  -l, --list-rollback-points      List rollback points
  -m, --full-index-info           Display full index information (Effective only for -l option)
  -v, --traverse=<strategy>       Set traverse mode for listing roll back points. Strategy should be forward or backward. (default: backward)
  -j, --erase-history             Erase history at rollback
  -k, --keep-history              Keep history at rollback (default)
  -q, --quiet                     Suppress informational messages
  -t, --trace                     Enable diagnostic output
      --syslogtrace               Enable diagnostic output to stderr and syslog
  -V, --version                   Version information
  -h, --help                      This help
  -p, --advanced-help             Full help, including advanced options

Copy link
Member

@vandelvan vandelvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great for supporting multiplatform.
Thanks!

Copy link
Contributor

@amissael95 amissael95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Piloalucard thanks for working on this change and make emphasis on the MSVC usage on windows. Approved!

@juliocelon juliocelon merged commit 1628440 into LinearTapeFileSystem:v2.4.8-windows-support Aug 11, 2025
8 of 10 checks passed
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.

5 participants