Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: tar: Pathname can't be converted from UTF-8 to current locale



Am 24.02.2023 um 22:55 schrieb Greywolf:
worked.

Glad that it worked out. Your first try was:

TAR=/usr/local/bin/gtar make -e TAR=/usr/local/bin/gtar extract

This approach would have worked for some of the commands that are listed
in pkgtools/bootstrap-mk-files/files/sys.mk.

In pkgsrc, the situation is a bit more complicated. There, each platform
defines the location where each of the common tools is found, in
mk/tools/tools.NetBSD.mk, in this case TOOLS_PLATFORM.tar.

Additionally, mk/tools/defaults.mk defines _TOOLS_VARNAME.tar=TAR, and
at the bottom of that file, the variable TAR is set.

When you overrode TAR=/usr/local/bin/tar, you only modified a result
variable but not the source of truth.

Before the 'extract' phase, the 'tools' phase runs, as documented at the
top of mk/bsd.pkg.mk. There, a wrapper for 'tar' is installed in $PATH,
based on TOOLS_PLATFORM.tar, not on the TAR you overrode.

make -e EXTRACT_CMD='gtar -zxf $${extract_file}' returned
'{extract_file}: No such file or directory'.
Perhaps I needed to double-quote that string.

Now that part is tricky and goes deep into the internals of make. I had
to look it up myself how that works, as I know that '$' characters often
behave unintuitively, especially when they are passed as command line
arguments. It could be regarded a bug in make, but '$' on the command
line is seldom used. If you're interested in further details, just ask. :)

EXTRACT_CMD='gtar -zxf $${extract_file}'
export EXTRACT_CMD; #I'm old school -- this is habit.
make -e extract

Instead, when you set EXTRACT_CMD via an environment variable, make just
passes the environment unaltered to its child processes, not touching
any '$' that is embedded there. That's why this variant worked.

Roland



Home | Main Index | Thread Index | Old Index