On 12 Mar 2019, at 22:55, MacPorts wrote:

This will also work if you remove the first file1, then create a new
file1. This is what most text editors (vi, vim, emacs) will do. They
move the original file to a temporary file, name the edited file the
original name, and remove the temporary file. This is how symbolic links
work on macOS.

No, that is how symbolic links work on every POSIX-compliant file system.

On Linux, this will break symbolic links.

You are mistaken.

Note the identical behavior from 5 random machines I had handy. 2 Macs, 3 Linux:

An OpenWRT wireless router:

        root@airhole:~# uname -a
        Linux airhole 4.4.140 #0 Fri Jul 13 19:25:14 2018 mips GNU/Linux
        root@airhole:~# echo 'file1' > file1
        root@airhole:~# ln -s file1 link1
        root@airhole:~# cat link1
        file1
        root@airhole:~# mv file1 file2
        root@airhole:~# echo 'fileb' > file1
        root@airhole:~# cat link1
        fileb

A client's antique server:

        [root@intel1 tmp]# uname -a
Linux intel1.REDACTED 2.4.27 #7 SMP Mon Feb 23 19:45:51 EST 2009 i686 unknown
        [root@intel1 tmp]# echo 'file1' > file1
        [root@intel1 tmp]# ln -s file1 link1
        [root@intel1 tmp]# cat link1
        file1
        [root@intel1 tmp]# mv file1 file2
        [root@intel1 tmp]# echo 'fileb' > file1
        [root@intel1 tmp]# cat link1
        fileb

A different wireless router:

        /opt/home/admin # uname -a
Linux asus-router 3.0.102 #1 Mon Feb 1 00:35:27 KRAT 2016 mips GNU/Linux
        /opt/home/admin # echo 'file1' > file1
        /opt/home/admin # ln -s file1 link1
        /opt/home/admin # cat link1
        file1
        /opt/home/admin # mv file1 file2
        /opt/home/admin # echo 'fileb' > file1
        /opt/home/admin # cat link1
        fileb

High Sierra:

        skinnyclam:~ $ uname -a
Darwin skinnyclam.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Dec 20 21:47:19 PST 2018; root:xnu-4570.71.22~1/RELEASE_X86_64 x86_64
        skinnyclam:~ $ echo 'file1' > file1
        skinnyclam:~ $ ln -s file1 link1
        skinnyclam:~ $ cat link1
        file1
        skinnyclam:~ $ mv file1 file2
        skinnyclam:~ $ echo 'fileb' > file1
        skinnyclam:~ $ cat link1
        fileb

Snow Leopard:

        bigsky:tmp root# uname -a
Darwin bigsky.REDACTED 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
        bigsky:tmp root# echo 'file1' > file1
        bigsky:tmp root# ln -s file1 link1
        bigsky:tmp root# cat link1
        file1
        bigsky:tmp root# mv file1 file2
        bigsky:tmp root# echo 'fileb' > file1
        bigsky:tmp root# cat link1
        fileb



--
Bill Cole
[email protected] or [email protected]
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Available For Hire: https://linkedin.com/in/billcole

Reply via email to