The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   Cannot delete zero byte files (http://hintsforums.macworld.com/showthread.php?t=3094)

Hunger Moon 05-25-2002 10:30 PM

oh, and I have no /lost+found ....

mervTormel 05-25-2002 10:30 PM

if you would email me your email address, i will send you a gzip'd GNU ls

see Author Info: below

also, include your PATH variable, like so:

# echo $PATH
/Users/merv/bin:/sw/bin:/sw/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

i take it you're running the tcsh shell?

WillyT 05-25-2002 11:25 PM

which rm
 
Hunger Moon

Do you have an old fink installation. At one time a slightly broken rm was included in one of the file utilities packages.

so try:
Code:

[darwin:~] williamt% which rm
/bin/rm

if it comes back anything other than /bin/rm then you have the broken one biteing you.

Willy

stetner 05-25-2002 11:36 PM

Looks to me like the files have been removed, but the directory entries still exist. Obviously this should not happen.

I would do the 9 boot to remove them (even if you have to boot from CD into 9).

mrdandy 06-01-2002 03:32 AM

just for the record, I had the same problem with some Bjork MP3s, I think it has something to do with that dotted "o" when combined with coming over from a PC.

In any case, I got rid of the files by booting into OS9 and deleting them, though I think that was already suggested here....

mervTormel 06-01-2002 03:52 AM

thanks, mrdandy. we're looking for a command line solution. one should be able to create, move, and delete these file names in the shell.

stetner (hi doug); another user has reported this issue with files not yet in the trash. it's one of those 8-bit chars that changes the name of the file when its referenced. or it's a bugaboo in the core brainpan.

think maybe an applescript could create a funky filename that shell would choke on? that's my approach, tho i'm loathe to do anything in AS (too cobol for me).

this hinkyness will, most likely, be less of an issue in jaguar.

stetner 06-01-2002 10:25 AM

Ok, lets break out the compiler and see what we can find 8-)
Code:

% cat dir_read.c
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>

int main(int argc, const char * argv[])
{   

    int i;
    char *c;
    DIR *dirp;
    struct dirent *dp;

    dirp = opendir(argv[1]);
    if (dirp)
    {
        while ((dp = readdir(dirp)) != NULL)
        {
                printf("good readdir\n");
                printf("d_fileno %d\n", (int) dp->d_fileno);
                printf("d_reclen %d\n", (int)dp->d_reclen);
                printf("d_type %d\n", dp->d_type);
                printf("d_namlen %d\n", dp->d_namlen);

                c = dp->d_name;
                for ( i = 0; i < dp->d_namlen; i++ ,c++ )
                {
                        printf( "char %d - as a num - %d  as a char %c\n", i, (int)*c, *c );
                }
                printf( "%s\n" , dp->d_name);
                printf("======================\n");
        }
    (void)closedir(dirp);
    }
}

If you put the above code into a file called dir_read.c and type
Code:

cc -o dir_read dir_read.c
you will get an executable which will give output like (when passed a directory name, '.' in this case)
Code:

% ll
total 0
drwx------    4 stetner  staff          92 Jun  2 00:05 ./
drwxr-xr-x  79 stetner  staff        2642 Jun  2 00:02 ../
-rw-------    1 stetner  staff          0 Jun  2 00:04 a?b
-rw-------    1 stetner  staff          0 Jun  1 23:13 b

% ../dir_read .
good readdir
d_fileno 866265
d_reclen 12
d_type 4
d_namlen 1
char 0 - as a num - 46  as a char .
.
======================
good readdir
d_fileno 35922
d_reclen 12
d_type 4
d_namlen 2
char 0 - as a num - 46  as a char .
char 1 - as a num - 46  as a char .
..
======================
good readdir
d_fileno 866395
d_reclen 12
d_type 8
d_namlen 3
char 0 - as a num - 97  as a char a
char 1 - as a num - 127  as a char 
char 2 - as a num - 98  as a char b
ab
======================
good readdir
d_fileno 866266
d_reclen 12
d_type 8
d_namlen 1
char 0 - as a num - 98  as a char b
b
======================

So maybe that can shed some light on what is happening. Of course this may just crash if the readdir call dies, but maybe it will show something usefull. The 'fileno' is actually the inode number, and worst case, 'clri' could be used to blow away the offending inode and then fsck the disk (ACK, I just remembered that clri doesn't work on HFS+). Anyway, let us know what it spits out..... might be interesting.
Doug


All times are GMT -5. The time now is 06:17 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.