Re: problem while moving HOME from FreeBSD to MacOS with bsdtar

From: Norman Gray <gray_at_nxg.name>
Date: Thu, 09 Mar 2023 09:57:44 UTC
Matthias, hello.

On 9 Mar 2023, at 8:41, Matthias Apitz wrote:

>> 	You seem to have the default case insensitive filesystem setup on
>> MacOS, you can change it - more details here:
>>
>> https://support.apple.com/en-ie/guide/disk-utility/dsku19ed921c/mac
>
>  I don't think, that this is the case:

As Steve says, APFS is by default set to be case-preserving but case-insensitive (that is, if you create a file 'Homework', it'll always be reported with that case, but it's deemed to be the same directory entry as 'HOMEWORK')

If I look at the (APFS) filesystem which contains my $HOME,

    % diskutil info /dev/disk3s1s1 | grep Personality
    File System Personality:   APFS

and a separate filesystem which I've created as case-sensitive (for Nix):

    % diskutil info /dev/disk3s8 | grep Personality
    File System Personality:   Case-sensitive APFS

>  APITZM-1MBPOH:~ apitzm$ touch Homework HOMEWORK

Here, you're simply touching the same file twice.

>  APITZM-1MBPOH:~ apitzm$ ls -l Homework HOMEWORK
>  -rw-r--r--  1 apitzm  OCLC\Domain Users  0  9 Mär 09:37 HOMEWORK
>  -rw-r--r--  1 apitzm  OCLC\Domain Users  0  9 Mär 09:37 Homework

Here, you're simply listing the same file twice, and if you add the -i option, you'll see (as Peter Holm points out) that they are in fact the same file.

You mention, though, that

> APITZM-1MBPOH:~ apitzm$ ls -ld guru/Mail guru/mail
>  -rw-r--r--  1 apitzm  OCLC\Domain Users  4016  9 Nov 12:36 guru/Mail
>  -rw-r--r--  1 apitzm  OCLC\Domain Users  4016  9 Nov 12:36 guru/mail
>
> but that guru/Mail was created as a plain file, why it is in the tar archive a directory.

Odd: I can't reproduce that

% tar tvf ../t.tar
-rw-r--r--  0 norman wheel       6  9 Mar 09:22 mail
drwxr-xr-x  0 norman wheel       0  9 Mar 09:22 Mail/
-rw-r--r--  0 norman wheel       6  9 Mar 09:22 Mail/hello
% tar xf ../t.tar
% ls -F
Mail/

% rm -Rf Mail
% tar tvf ../t2.tar
drwxr-xr-x  0 norman wheel       0  9 Mar 09:22 Mail/
-rw-r--r--  0 norman wheel       6  9 Mar 09:22 Mail/hello
-rw-r--r--  0 norman wheel       6  9 Mar 09:22 mail
% tar xf ../t2.tar
mail: Can't replace existing directory with non-directory
tar: Error exit delayed from previous errors.
% ls -F
Mail/
%

macos% tar --version
bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8


So, it's expected that you can't have a file 'mail' and a directory 'Mail' together, but it's not clear how you've managed to end up with a file 'mail' and no directory.  I'm slightly surprised that the first tar xf above didn't result in an error, and apparently silently replaced file 'mail' with directory 'Mail'.  Perhaps this is a bsdtar version issue?

The t.tar and t2.tar were created on FreeBSD, with

freebsd% tar --version
bsdtar 3.6.0 - libarchive 3.6.0 zlib/1.2.12 liblzma/5.2.5 bz2lib/1.0.8 libzstd/1.4.8

Best wishes,

Norman


-- 
Norman Gray  :  https://nxg.me.uk