Hacker News new | past | comments | ask | show | jobs | submit login

so what's the situation like on el capitan ?



On ElCapitan:

    sh-3.2# pwd
    /var/root
    sh-3.2# ln -s ftw $str1/$str2/$str3/$str4/L
    ln: 1.../2.../3.../4.../L: File name too long


Yay, that's actually the right error. MAX_PATH in xnu (the OS X kernel) is 1024 so it's not unsurprising that things get weird when you have paths at least 1025 characters long as in his example.


> MAX_PATH in xnu (the OS X kernel) is 1024 so it's not unsurprising that things get weird when you have paths at least 1025 characters long as in his example.

What is surprising is the asymmetry: you can create the symlink, but cannot remove it.


If you make a directory tree "a/a/a/a/a/a/a" and then rename every directory to "aaaaaaa (x255)" starting on the inner directory... How does other OSes deal with this? Does every rename at a top level folder check the filenames recursively first?


That’s interesting. I’m on El Capitan too (10.11.1) and as root I can create the symlink but not remove it. Might you be using a different filesystem or something?


How strange. I'm also on 10.11.1, and I get "file name too long":

  sh-3.2# ln -s ftw $str1/$str2/$str3/$str4/L
  ln: 1.../2.../3.../4.../L: File name too long

  sh-3.2# mount
  /dev/disk1 on / (hfs, local, journaled)
  ...
Edit: see my comment above - you can indeed create a path too long; just not in one go.


Ah, it looks as though it works in /tmp (where I first tried) though not in my home directory. Very odd…


Not to directly answer your question but, I'm using Yosemite 10.10.5 and it's easy enough to check:

  plo-pro:~ root# pwd
  /var/root
  plo-pro:~ root# str1=$(python -c "print '1' * 255")
  plo-pro:~ root# str2=$(python -c "print '2' * 255")
  plo-pro:~ root# str3=$(python -c "print '3' * 255")
  plo-pro:~ root# str4=$(python -c "print '4' * 253")
  plo-pro:~ root# mkdir -p  $str1/$str2/$str3/$str4
  plo-pro:~ root# ln -s ftw $str1/$str2/$str3/$str4/L
  plo-pro:~ root# (cd $str1/$str2/$str3/$str4; unlink L)
  unlink: L: No space left on device
(all the other obvious delete commands also fail)


El Capitan won't let you create the path in one go (it gives file name too long), but you can create it incrementally:

  sh-3.2# pwd
  /private/var/root/1.../2.../3.../4...
  sh-3.2# ln -s /var/root/ftw L
  sh-3.2# rm L
  rm: L: No space left on device




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: