You are not logged in.

#1 2009-01-12 02:26:43

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Irregular characters show up as '?' in filenames, cannot delete

Okay, this is a REALLY perplexing problem. I've done hours upon hours of Googling and forum searching to no avail, and I've even tried changing my locale, and various forms of character escaping. Nothing seems to help!

I have some files with characters in their names that are outside of the en_US.UTF-8/ISO-8859-1 set, and I have no clue which set they are actually in. bash or glibc (I don't know what's causing it) is mapping those characters to '?', which is preventing me from doing ANYTHING to them. I cannot delete, move, copy, etc., because an escaped '?' is being used to refer to the files' names whenever I try deleting them, and for each such file this does not properly represent the actual file name.

Here are some examples:

$ ls
ls: cannot access 03 Suen?o Con Mexico.mp3: No such file or directory
03 Suen?o Con Mexico.mp3
$ cd ..
$ rm -r cdm/
rm: cannot remove `cdm/03 Suen?o Con Mexico.mp3': No such file or directory
$ rmdir cdm/
rmdir: failed to remove `cdm/': Directory not empty

Is there any way to display output in some form other than text, i.e. hex, and then use that to specify/target the files for deletion?

Also, if this helps: I'm using en_US.UTF-8, the filesystem type is JFS, and the files I'm having trouble with were copied from a FAT32 volume, and the files were originally created on that volume in Mac OS X.

Offline

#2 2009-01-12 02:35:53

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Irregular characters show up as '?' in filenames, cannot delete

Have you tried using the inode number? http://www.cyberciti.biz/tips/delete-re … umber.html
I've seen someone else with this problem and I think it was solved this way.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2009-01-12 02:38:14

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Irregular characters show up as '?' in filenames, cannot delete

Forcing removal (-f) does not work? Did you try it as root too?

What I often do - it's not an ideal solution but it's a workaround - is open a file manager and just click the darn thing and press shift+Del tongue. It usually works... I only do that when I can't get Tab to tab-complete the name of the file in a terminal though. You're sure you have the necessary locales enabled in /etc/locale.gen?


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#4 2009-01-12 02:56:21

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: Irregular characters show up as '?' in filenames, cannot delete

Isn't this also the error message for a corrupted filesystem? I'd run fsck on it.

Offline

#5 2009-01-12 03:05:01

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

Yes, I have already tried rm -f as root. Also, I took the suggestion (thanks!) to try stat and ls -il, but they didn't work either;

$ ls -il
ls: cannot access 03 Suen?o Con Mexico.mp3: No such file or directory
total 0
344391 ?????????? ? ? ? ?                ? 03 Suen?o Con Mexico.mp3
$ stat *
stat: cannot stat `03 Suen?o Con Mexico.mp3': No such file or directory

edit: I've also tried getting in there with Nautilus via ssh/gvfs, and the files don't even show up! They're on a separate "headless" computer running Arch.

Last edited by deconstrained (2009-01-12 03:10:12)

Offline

#6 2009-01-12 03:43:39

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

Okay, I just tried attaching the physical disk to my desktop PC, which is running Ubuntu, and I fsck'd / mounted it. The filesystem is clean, but I tried to delete the files both via Nautilus and the terminal, and the same exact problems occured.

Should I try deleting the directory that the corrupted files are in via its inode? Will this also remove the files that it contains, or leave the files sitting on some sector of the disk? Will it cause damage to the filesystem?

Last edited by deconstrained (2009-01-12 03:44:57)

Offline

#7 2009-01-12 03:48:59

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Irregular characters show up as '?' in filenames, cannot delete

The inode is the entry of the data in the file system, so technically the data will still be there, the filesystem just erases all tracks of it. So that should fix your problem, it will be overwritten with whatever data needs space next. It's like ripping the table of contents of a book - the data will still be there but no easy way to find it smile.

Why not just delete the file by inode? You have it no?

find . -inum 344391 -exec rm -i {} \;

Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#8 2009-01-12 03:51:30

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

Oh, well yes - I can get the inode of the folder they're in. There aren't any weird characters in its name :-)

I'm going to try what you suggested.

Last edited by deconstrained (2009-01-12 03:52:45)

Offline

#9 2009-01-12 03:53:37

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Irregular characters show up as '?' in filenames, cannot delete

Wait wait wait.... ls -li does complain but it also shows an inode number smile. I presume that is the inode number of the file, since it has the file name on the very same line. Try that first.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#10 2009-01-12 04:03:56

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

Okay, I tried deleting via find & inode number, and it returned the exact same error for the contents.

Offline

#11 2009-01-12 04:09:00

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Irregular characters show up as '?' in filenames, cannot delete

Sorry, then I don't know. If deleting the file itself by inode doesn't work then I don't think deleting the dir containing it won't help much either...


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#12 2009-01-12 04:20:33

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

For some reason it took me until now to recognize that ls -li was giving me inode numbers for the files despite complaining. Nevertheless, I tried deleting an individual file and not rather its containing folder by inode, and this resulted in the same problem. Thank you for your help though.

Last edited by deconstrained (2009-01-12 04:21:05)

Offline

#13 2009-01-12 17:33:27

nebri
Member
Registered: 2009-01-03
Posts: 30

Re: Irregular characters show up as '?' in filenames, cannot delete

Just a quick suggestion but because I haven't seen it yet I've gotta throw it out there as simple and obvious as it is.

try running rm -rf on the directory containing the file in question. BE CAREFULL with your syntax as this will descend into a directy recursively and delete everything within, which can potentially cause a lot of damage if mis typed.

Offline

#14 2009-01-12 17:38:56

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Irregular characters show up as '?' in filenames, cannot delete

what about the '*' key, doesn't that mean 'everything'?

rm -R cdm/*

very odd that a stupid '?' character can stop you from deleting the file. I know linux takes no prisoners when it comes to * as I have been caught myself before.

edit: NVM, I see you have tried it. Looks like a more sinister problem. I wonder, can you mv the file to /tmp and have it deleted on reboot?

Last edited by jacko (2009-01-12 17:41:21)

Offline

#15 2009-01-12 18:13:07

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

jacko wrote:

edit: NVM, I see you have tried it. Looks like a more sinister problem. I wonder, can you mv the file to /tmp and have it deleted on reboot?

Hey...That's a really good idea! I think I'm going to try that, although I hope that failure to delete it (if that becomes the case) doesn't prevent me from booting up!

EDIT:
scared_avatar.jpg
OMG I TRIED IT AND IT FAILED TO BOOT UP!!!

Last edited by deconstrained (2009-01-12 18:33:29)

Offline

#16 2009-01-12 18:33:20

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

Re: Irregular characters show up as '?' in filenames, cannot delete

is it a FAT/NTFS/JFS/ISO9660/UDF filesystem? have you tried

mount -o iocharset=utf8 /dev/bla /bla

?

Last edited by schuay (2009-01-12 18:36:31)

Offline

#17 2009-01-12 18:37:12

deconstrained
Member
Registered: 2008-03-31
Posts: 49

Re: Irregular characters show up as '?' in filenames, cannot delete

Actually, not FAT; the files are on a JFS filesystem, but now that you mentioned it I looked at the man page for mount and found that the iocharset mount option is available for JFS. Now that I've rescued my system by using another Linux to move the files out of /tmp, I'm going to try putting that option in /etc/fstab and see if rebooting will finally allow me to remove the files.

EDIT:
WOW. Okay, problem solved. User error. Root filesystem was not mounted with the same iocharset as that which the kernel uses. Didn't properly configure /etc/fstab in the first place.

Last edited by deconstrained (2009-01-12 18:40:36)

Offline

Board footer

Powered by FluxBB