On Fri, Dec 11, 2020 at 12:23:10PM -0500, Robert Haas wrote: > On Fri, Dec 11, 2020 at 3:04 AM Michael Paquier <mich...@paquier.xyz> wrote: > > Why don't you just use Archive::Tar [1] instead of looking for some system > > commands? Combining list_files() with extract(), it is possible to > > extract an archive, with or without compression, without hoping for an > > equivalent to exist on Windows. That would not be the first time > > either that there is a TAP test that skips some tests if a module does > > not exist. See for example what psql does with IO::Pty. > > Well, either this or Noah's method has the disadvantage that not > everyone will get the benefit of the tests, and that those who wish to > get that benefit must install more stuff. But, all three of the > computers I have within arm's reach (yeah, I might have a problem) > have Archive::Tar installed, so maybe it's not a big concern in > practice. I am slightly inclined to think that the perl package > approach might be better than shell commands because perhaps it is > more likely to work on Windows, but I'm not positive.
Outside Windows, Archive::Tar is less portable. For example, in the forty-two systems of the GCC Compile Farm, five lack Archive::Tar. (Each of those five is a CentOS 7 system. Every system does have tar, gzip and gunzip.) Either way is fine with me. Favoring Archive::Tar, a Windows-specific bug is more likely than a CentOS/RHEL-specific bug. Favoring shell commands, they can catch PostgreSQL writing a tar file that the system's tar can't expand.