?
Solved

glob not working in an NTFS mount

Posted on 2005-02-24
19
Medium Priority
?
507 Views
Last Modified: 2013-12-15
I've got a Windows XP box, which I've made a directory a shared NTFS directory using Unix Services for Windows. Things are working nicely enough, editing code in Windows and compiling code in a Linux mount . However, I'm puzzled about globbing from Linux. I notice that find . doesn't recurse through the directories on /mnt/mydirectory and I also notice that *.dsp doesn't glob through directories.

Specifically, what I need to do is to...

     dos2unix --u2d *.dsp

.. to redosify a bunch of files I've erroneously converted to UNIX format. But the crux of my question is about globbing.

I don't know if it is relevant, but my /etc/fstab file deals with the mount as follows:

    192.168.1.126:mydir /mnt/mydirectory   nfs         defaults         0   0
0
Comment
Question by:rstaveley
  • 8
  • 7
  • 4
19 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 13395572
Hi,

   It's the behavior of Windows application which put ^M at the end of each line.
You can use ftp to upload file to Linux to see if the globbing exist or not.

  However, Unix/Linux application doesn't do that. So you need to run unix2dos (or dos2unix --u2d)
to put ^M at the end of each line.

  This has nothing to do with NTFS mount through SFU. It's application issue between Windows and Unix.

Regards,

Wesly
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13396189
globbing is a feature of the shell, not the filesystem


> I notice that find . doesn't recurse through
what does find then do? it should traverse the directory tree, please post your command
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13396298
I've expressed myself badly. The characteristic of globbing that I'd like to use on the Linux box is do do something like:

   dos2unix --u2d *.dsp

This ought to dosify...

      somefile.dsp
      somepath/somefile.dsp
      somepath2/somefile.dsp
      etc

..in one hit. I'd expect the bash shell to expand *.dsp for the dos2unix utility to process all files in subdirectories with the extension .dsp.

Similarly, executing the command...

      find . | grep dsp

...should list...

      somefile.dsp
      somepath/somefile.dsp
      somepath2/somefile.dsp
      etc

It certainly works in a normal directory on Linux, but find fails to recurse through directories in the NFS mount (sorry I typed NTFS was my typo... certainly it is NTFS rather than FAT32... but that's not really the point).

Is there a way to get globbing to work through directories on the NFS mount ?

I was wondering why this happens and if there is a way to get globbing to work properly through directories in the NFS mount.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Author Comment

by:rstaveley
ID: 13396312
> what does find then do? it should traverse the directory tree, please post your command

In the NFS directory it only lists the files in the current directory. It fails to list files in subdirectories and doesn't even say that it is unable to open them or whatever.
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 13396424
find . -type f -name "*.dsp" -exec dos2unix --u2d {} \;

Make sure the read&execute permission on those subdirectories.
You need to make "everyone" read and write permission on Windows side,

Wesly
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13396675
> This ought to dosify...
are you shure your dos2unix can handle more than one file?

> .. in the NFS mount (sorry I typed NTFS was my typo.
and in your question:
> shared NTFS directory using Unix Services for Windows.

so, what's the truth now? is NFS or NTFS on Windoze?
How did you mount it from Linux?

try:
        find . -print | grep dsp
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 13396779
Good point, ahoffmann.

for FILE in find . -type f -name "*.dsp"; do  dos2unix --u2d $FILE ; done

> is NFS or NTFS on Windoze?
He shared out NTFS through Unix Service for Windows (SFU) as NFS server.

Wesly
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13396894
> He shared out NTFS through Unix Service for Windows (SFU) as NFS server.
ROFLOL, sounds like we struggle with something trying to do what UNIX does since 20 years flawlesly ...
sorry for being off-topic ;-)
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13396953
ahoffmann,

> so, what's the truth now? is NFS or NTFS on Windoze?

Actually both. The directory is on a Windows XP machine, which uses NTFS. It was made to be an NFS share using Windows Services for UNIX.

>      find . -print | grep dsp

It doesn't recurse into subdirectories and doesn't print error messages. It is as if the subdirectories were not there.

Wesly,

>  find . ...etc

Same deal. find is not recursing into subdirectories.

> Make sure the read&execute permission on those subdirectories.
> You need to make "everyone" read and write permission on Windows side,

Permissions for the shared directory are right for the user. Looking at the directory listing it belongs to myuser:mygroup. However, I need to check those subdirectories, which I'll do tomorrow because I'm away from the office. I can certainly cd into them and read and write files OK in Windows and Linux, though, which presumably means the permissions are OK.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 186 total points
ID: 13396987
get rid of SFU and use something reliable, for example Samba on Linux
Means use smbclient or smbmount from Linux to mount the share.
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13397017
> ROFLOL

Yes, the approach certainly isn't my choice, but it is a "working system". Linux is running in VMWare too. Fortunately the office PC has 1G or RAM to cope with the flab.
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13397050
>  get rid of SFU and use something reliable

Does SFU have a history of problems in this respect? I'm new to this set-up. I'm simply reproducing the system used by the original developer, with whom I need to work concurrently (hence CVS). He said that Samba didn't work for him, but didn't specify why.
0
 
LVL 38

Accepted Solution

by:
wesly_chen earned 189 total points
ID: 13397143
> Linux is running in VMWare too
So you try to access your host XP from the Linux in VMWare guest OS?
Samba is the one I used.
In Linux, do
mkdir /mountpoint
smbmount //XP name/name_of_share  /mountpoint -o username=username,password=thepassword

Wesly
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13397275
> Does SFU have a history of problems in this respect?
hmm, don't knwo, but this would increase that list

> .. it is a "working system"
how could it be?
see your find problem above ... or do you define that "working"?
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13397839
Wesley,

> So you try to access your host XP from the Linux in VMWare guest OS?

Yes. The difference between the NFS approach and Samba is that the host operating system for the directory is Win32 rather than Linux.

I'll certainly try setting up Samba and see if I encounter the pitfalls that the other developer talked about.

ahoffmann,

>> .. it is a "working system"
> how could it be?

This is the only flaw I've encountered so far. Like I said, though, I'm not an advocate. I'm trying to avoid differences between my set up and the original developer's. My choice would be to keep separate copies of the source tree on Windows and Linux and have them access files from CVS independently.

Many thanks to both of you for your comments. I guess there's no known reason why globbing and recuring through the directory structure with find shouldn't work with my NFS mount other than the possibility of buginess in SFU.
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13398002
I guess this is an Interix issue - see http://lists.gnu.org/archive/html/bug-bash/2004-05/msg00005.html - oh well
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13398360
rstaveley, nice link. But referes to bash on windoze ...

glad to have helped you, thanks for grading
0
 
LVL 17

Author Comment

by:rstaveley
ID: 13400807
>  bash on windoze

Yes, I appreciate that but my *guess* is that the process of globbing requires some sort of communication with the device used for the mount ...and that the Interix (= Windoze's) BASH shell's globbing is failing for the same reason that Linux's BASH shell is failing to glob (or find .) ...and that's related to the device rather than the shell itself. When I get to the office this morning, I'll see if I can find out more.

I've been giving the other developers approach a little bit more thought. Its adavantage over the Samba approach is that you can develop and test in Win32, when the Linux box is unavailable (e.g. when VMWare isn't running). That is pretty handy bearing in mind what a memory hog VMWare is. That won't be an issue, if I can talk them into purchasing a separate PC that I can SSH into for Linux.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13401160
>  ...and that's related to the device ..
.. that's the SFU part, which seems to be buggy
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question