Register FAQ SearchLogin
Tuxera Home
View unanswered posts | View active topics It is currently Thu May 23, 2013 04:38



Post new topic Reply to topic  [ 4 posts ] 
Problems with shell expansion of "*" - spaces in filenames 
Author Message

Joined: Sun Mar 08, 2009 13:39
Posts: 2
Post Problems with shell expansion of "*" - spaces in filenames
Hi,

I'm seeing some strange behaviour with the expansion of "*" as a list of files, when there are spaces in filenames and they're on a NTFS-3G mounted filesystem. A filename with a space in it, is expanded to both the words individually AND the real name - e.g., "My Data" becomes "My", "Data", and "My Data" ! This doesn't occur if the directory being processed is on a EXT3 or XFS filesystem.

For example - If I want to process all the files/subdirectories in a directory in some way, in a shell script, I'll use something like this:

BASEDIR=/data

for MyFile in ${BASEDIR}/* ; do
echo Processing "$MyFile"
acommand "$MyFile"
done

If the directory /data contains two items, "My Data" and "SingleWord", then we get these results:
- On a XFS filesystem, that will process the file or subdirectory "My Data" as one item just like it would "SingleWord".
- On NTFS, it processes "My", "Data", and "My Data" and then "SingleWord".


Does anyone know how to stop this happening and get the same behaviour on the NTFS FS as on the Linux native ones?

Thanks!


Sun Mar 08, 2009 13:50
Profile
NTFS-3G Lead Developer

Joined: Tue Sep 04, 2007 17:22
Posts: 1008
Post Re: Problems with shell expansion of "*" - spaces in filenames
Hi,

With which OS, ntfs-3g and shell do you experience this ?

Does the path to "/data" contain spaces (in any of the situations on XFS or NTFS) ?

When executing of a Windows system root, I get "My Music", "Program Files", etc. normally. Same with files and directories created by ntfs-3g.

Regards

Jean-Pierre


Sun Mar 08, 2009 15:07
Profile

Joined: Sun Mar 08, 2009 13:39
Posts: 2
Post Re: Problems with shell expansion of "*" - spaces in filenames
It's openSUSE 11.1, and the shell is bash. ntfs-3g is 2009.2.1 - updated it from one of the OSS repositories about a week ago.

The path "/data" is just that - no spaces or anything unusual. I changed it slightly in the n XFS, it's really called /data and on the NTFS disk, it's the root of an external NTFS disk (eSATA) mounted to Linux as /backup, so Linux sees it as simply /backup. I've also got the same result by trying it one level down the tree, so "for i in /backup/morepathname/*" etc...

Interesting that you don't see the same behaviour. Must be something strange this end, but I'm stumped right now!


Sun Mar 08, 2009 15:52
Profile
Tuxera CTO

Joined: Tue Nov 21, 2006 23:15
Posts: 1645
Post Re: Problems with shell expansion of "*" - spaces in filenames
Hi,

Very weird. I've never heard anything like this. I can't reproduce it either on openSUSE 11.0 with any shell.

It's should be either your script, or openSUSE 11.1 bash bug, or a very non-standard OSS ntfs-3g 2009.2.1 package.

Regards, Szaka


Tue Mar 17, 2009 04:10
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: Google [Bot], Wiliancysnani and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Original forum style by Vjacheslav Trushkin.