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

2023-02-24 Thread Steffen Nurpmeso
Joerg Sonnenberger wrote in
 :
 |Am Fri, Feb 24, 2023 at 12:45:54PM -0800 schrieb Greywolf:
 |> I would be appreciative of any clues pointing toward a solution.
 |
 |Two options:
 |(1) Force C.UTF-8 for the extract step on systems that can support it.
 |(2) Try --options hdrcharset=BINARY for (bsd)tar.

fwiw the CRUX-Linux i use changed for its pkgmk

-   bsdtar -c $COMPRESSION -f $TARGET *  &&  bsdtar -t -v -f $TARGET
+   bsdtar --format=gnutar -c $COMPRESSION -f $TARGET *  &&  bsdtar 
-t -v -f $TARGET

in last April.  (Instead of reporting upstream issues with
tarballs, i took a look into libarchive iconv handling and it is
going miles and miles to be correct, but i cannot help it.  Now
they dump broken input 1:1 onto their filesystems.  Luckily i did
not use those packages.)

--steffen
|
|Der Kragenbaer,The moon bear,
|der holt sich munter   he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


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

2023-02-24 Thread Joerg Sonnenberger
Am Fri, Feb 24, 2023 at 12:45:54PM -0800 schrieb Greywolf:
> I would be appreciative of any clues pointing toward a solution.

Two options:
(1) Force C.UTF-8 for the extract step on systems that can support it.
(2) Try --options hdrcharset=BINARY for (bsd)tar.

Joerg


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

2023-02-24 Thread Roland Illig

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



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

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

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

worked.  Thank you.

On Fri, Feb 24, 2023 at 1:22 PM bch  wrote:
>
>
>
> On Fri, Feb 24, 2023 at 12:46 Greywolf  wrote:
>>
>> Hi there, having a problem more and more building from pkgsrc (see Subject):
>>
>> Output from "locale | awk '/CTYPE|LANG|ALL/' is as follows:
>>
>> LANG="en_US.UTF-8"
>> LC_CTYPE="en_US.UTF-8"
>> LC_ALL="en_US.UTF-8"
>>
>> I cannot seem to force TAR to be /usr/local/bin/gtar when extracting,
>> no matter what I try within my scope of knowledge. I've attempted the
>> full-on brute force method of:
>>
>> TAR=/usr/local/bin/gtar make -e TAR=/usr/local/bin/gtar extract
>>
>> and to no avail -- the value never makes it to the 'extract' script in
>> /usr/src/mk/extract/extract.
>>
>> I would be appreciative of any clues pointing toward a solution.
>
>
> I’ve seen the same (seems esp trigger-able by lang/go test cases, for example)
>
> I’ve pushed through w GNU tar before, but it’d certainly be nice to get 
> libarchive (which I believe gets hung-up) working…
>
> You might get traction with:
> EXTRACT_CMD= gtar -xzf $${extract_file}
>
> Good luck,
>
> -bch
>
>>
>>
>> [Note: LANG=C is my usual preferred (interactive) localisation -- I'm
>> only setting it here so I can build a package.]
>> --
>> --*greywolf;



-- 
--*greywolf;