<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:10pt"><div><br>Hello,<br><br>Following Paul's suggestion, I did the following:<br>#> cd /tmp<br>#> unlink cabal-install ...<br>#> ls (-> nothing)<br>#> cd ..<br>#> umount /tmp<br>#> zfs create rpool/export/tmp<br>#> zfs set mountpoint=/tmp rpool/export/tmp<br>#> cd /tmp; touch foo (-> ok, foo is there)<br>#> cd ~; cabal install --global cabal-install<br>tada! It's working<br><br>It's probably a problem with tmpfs then...<br><br>Hope this helps.<br><br>Matthieu</div><div><br></div>  <div style="font-family: Courier New, courier, monaco, monospace, sans-serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">De :</span></b> Paul B. Henson
 <henson@acm.org><br> <b><span style="font-weight: bold;">À :</span></b> omnios-discuss@lists.omniti.com <br> <b><span style="font-weight: bold;">Envoyé le :</span></b> Vendredi 10 mai 2013 2h50<br> <b><span style="font-weight: bold;">Objet :</span></b> Re: [OmniOS-discuss] cannot remove temp dir<br> </font> </div> <div class="y_msg_container"><br>> On 5/9/2013 7:28 AM, Matthieu Paindavoine wrote:<br>><br>>> I am new to OmniOS. I am trying to setup a Haskell development<br>>> environment and ran against a bump that's preventing me from completing<br>>> the task. I mentioned this problem yesterday on IRC and got some help,<br>>> but no definitive solution.<br>> [...]<br>>> execve("/usr/gnu/bin/rm", 0x08047D24, 0x08047D34)  argc = 3<br>> [...]<br>>> rmdir("cabal-install-1.16.0.2-21814")        Err#17 EEXIST<br><br>Matthieu provided remote access to the system he was
 working on, and I <br>took a look at this.<br><br>On the one hand, it's fairly clear why the directory can't be deleted:<br><br># ls -ld cabal-install-1.16.0.2-21814<br>drwx------ 3 root root 117 May 10 02:00 cabal-install-1.16.0.2-21814<br>           ^^^<br><br>It's got a link count of 3, and per the tmpfs code:<br><br>tmp_rmdir(<br>[...]<br>         if (self->tn_nlink > 2) {<br>                 mutex_exit(&self->tn_tlock);<br>                 error = EEXIST;<br><br>If a directory has a link count greater than two, it returns EEXIST.<br><br>It's also fairly easy to replicate the scenario:<br><br># mkdir test<br># ls -ld test<br>drwxr-xr-x 2 root root 117 May 10 02:27 test<br><br># link test test2<br># ls -ld test test2<br>drwxr-xr-x 3 root root 117 May 10 02:27 test<br>drwxr-xr-x 3 root root 117 May 10 02:27
 test2<br><br># rmdir test<br>rmdir: failed to remove 'test': File exists<br><br># unlink test2<br># rmdir test<br><br>What's not so obvious is where the other link to the directory <br>cabal-install-1.16.0.2-21814 is. For my simple test:<br><br># ls -lid test*<br>2675840857 drwxr-xr-x 3 root root 117 May 10 02:28 test<br>2675840857 drwxr-xr-x 3 root root 117 May 10 02:28 test2<br><br>The two links of course have the same inode, and if you search by inode:<br><br># find . -inum 267584085<br>./test<br>./test2<br><br>They are both found. On the other hand, for the cabal directory:<br><br># ls -lid cabal-install-1.16.0.2-21814<br>2677295311 drwx------ 3 root root 117 May 10 02:00 <br>cabal-install-1.16.0.2-21814<br><br># find . -inum 2677295311<br>./cabal-install-1.16.0.2-21814<br><br>There appears to only be one link with that inode on the file system. <br>This is all in /tmp, mounted on tmpfs:<br><br># mount | grep tmp<br>/tmp on swap
 read/write/setuid/devices/xattr/dev=83c0002 on Thu May  9 <br>09:37:34 2013<br><br>So I don't really see that there's any other place a link could exist, <br>it won't allow you to link across devices. Just for fun I tried a search <br>starting at the root:<br><br># find / -inum 2677295311<br>/tmp/cabal-install-1.16.0.2-21814<br><br>Just the one link.<br><br>So I'm a bit stumped. What I would probably do next is run whatever <br>process generates the cabal directory under truss -f and see what's <br>calling the link syscall. Matthieu, perhaps you could do that and make <br>the output available?<br><br>I think I might post this to the developer list, and see if anybody has <br>any idea where that other link disappeared to. Matthieu, I'd also be <br>curious to see what would happen if you unmounted /tmp from tmpfs and <br>used just a regular zfs filesystem, perhaps the build is doing something <br>weird that's poking a bug in tmpfs resulting in a
 dangling reference?<br><br>_______________________________________________<br>OmniOS-discuss mailing list<br><a ymailto="mailto:OmniOS-discuss@lists.omniti.com" href="mailto:OmniOS-discuss@lists.omniti.com">OmniOS-discuss@lists.omniti.com</a><br><a href="http://lists.omniti.com/mailman/listinfo/omnios-discuss" target="_blank">http://lists.omniti.com/mailman/listinfo/omnios-discuss</a><br><br><br></div> </div> </div>  </div></body></html>