MacPorts duplicate files or hardlinks?

Scott Haneda talklists at newgeo.com
Sun May 24 15:45:23 PDT 2009


* Glad I replied to this one, there is a lot of odd stuff going on I  
can not explain, hope someone where more knowledgeable about the  
phases can explain...

According to the man page, that 2 is for directories.  I do not think  
it has any bearing on the type of file it is. It is a count of some  
form.

Below is some testing I did.  If you are going to delete, I would  
recurse, run `file` on the item, make sure it is a link, and then  
delete. I do not think you should delete them that way though.

I think this would be a good thread to look at:
http://www.nabble.com/%22Reclaiming-disk-space%22-documentation-guide-missing-td23686542.html

I just ran `$sudo port distfiles all`, very chatty results.

I did try to run this, according to that thread:
$sudo port clean --distfiles all
Error: clean does not accept --distfiles

Then I tried
sudo port clean --all all
which worked a little, but got hung on..

couldn't change working directory to "/opt/local/var/macports/build/ 
_opt_local_var_macports_sources_rsync 
.macports.org_release_ports_sysutils_am-utils/work": no such file or  
directory
     while executing
"cd $savedir"
     (procedure "foreachport" line 17)
     invoked from within
"foreachport $portlist {
         set target $action

         # If we have a url, use that, since it's most specific
         # otherwise try to map the ..."
     (procedure "action_target" line 7)
     invoked from within
"$action_proc $action $portlist [array get global_options]"
     (procedure "process_cmd" line 86)
     invoked from within
"process_cmd $remaining_args"
     invoked from within
"if { [llength $remaining_args] > 0 } {

     # If there are remaining arguments, process those as a command

     # Exit immediately, by default, unless..."
     (file "/opt/local/bin/port" line 3247)
pwd: error retrieving current directory: getcwd: cannot access parent  
directories: No such file or directory

Now `sudo port distfiles all` is broken.

For what is is worth, here are the tests I did to make sure deleting  
the hard links would not hurt outside of ports, within ports, no idea.
I just did this test:
# Make a file on the Desktop
$touch ~/Desktop/original_file

# Show where I am in the shell, in this case, test dir on desktop
$pwd
/Users/me/Desktop/test

# link to the file in the desktop from the test dir I am sitting in
$ln ~/Desktop/original_file linked_file

# Show the result of the link I just made:
$ls -la
total 8
drwxr-xr-x   3 haneda  staff  102 May 24 15:24 .
drwx------+ 11 haneda  staff  374 May 24 15:23 ..
-rw-r--r--   2 haneda  staff   21 May 24 15:24 linked_file

# Put some data into the original_file
$echo 'this is the original' >> ~/Desktop/original_file

# Check of the link worked by reading the link
$cat linked_file
this is the original

# Both files show 21 bytes, but use `file` to see what it is
$file linked_file
linked_file: ASCII English text

# Compared to the other file
$file ~/Desktop/original_file
/Users/me/Desktop/original_file: ASCII English text

# Delete the link
$rm linked_file

# make sure the original is still there
$ls -la ~/Desktop/ | grep original
-rw-r--r--   1 haneda  staff     21 May 24 15:24 original_file

On May 24, 2009, at 12:03 PM, Bee wrote:

> MacPorts 1.7 selfupdate (recently)
> MacOS 10.4.11
>
> MacPorts seems to keep many duplicate files.
>
> As an example, I did a search for duplicates I found these identical  
> files:
>
> /opt/local/bin/vim
> /opt/local/var/macports/software/vim/7.2.182_0/opt/local/bin/vim
>
> Are these really a duplicate files or a hardlink?
> I think the "2" before the "root" means it has a hardlink. Is that  
> correct?
>
> -rwxr-xr-x   2 root  admin  - 1462888 May 17 22:26 vim
>
> If duplicate files:
> + Is there a reason both are kept?
> + Is there a way to "clean" duplicates?

-- 
Scott * If you contact me off list replace talklists@ with scott@ *



More information about the macports-users mailing list