Bug 4614 - nocase not working as expected when opening files
Summary: nocase not working as expected when opening files
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: x86 Linux
: P3 major
Target Milestone: ---
Assignee: shirishpargaonkar@gmail.com
QA Contact:
Depends on:
Reported: 2007-05-12 05:42 UTC by Christoph Kaser
Modified: 2012-05-14 10:33 UTC (History)
2 users (show)

See Also:

patch to indicate server about file names case sensitivity (807 bytes, patch)
2010-02-12 12:23 UTC, shirishpargaonkar@gmail.com
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Kaser 2007-05-12 05:42:36 UTC

I am having a problem with the nocase option here: When I do a ls and specify the "wrong" case, all works well. However, when I try to open a file / create a file in a directory / etc, I get a file not found error.

For example, I have mounted a directory using
 mount -t cifs -oiocharset=utf8,nocase,user=bla //linux3/vol2 test/

when I do "ls test", I get:

MENU is a directory. When I do ls test/menu (spelling MENU lower case), it works:
bla (being a file)
When I try to cat test/menu/bla, it does not work!! cat test/MENU/bla does work, however.
The same goes for touch test/menu/bla2 - again, MENU works here..

This is a real big problem for me, because for campatibly with Windows, I DO need case insensivity. Using smbfs does not work however due to some strange charset errors.

I am using smbd v 3.0.24 and mount.cifs version: 1.10-3.0.24 (On a debian / lenny system)

Christoph Kaser
Comment 1 shirishpargaonkar@gmail.com 2009-10-13 05:43:37 UTC
I think this is fixed.  I tried against Samba Version 3.4.0-GIT-26e114b-devel
and it works with mixed case also.
I am using cifs version 1.60.
Comment 2 shirishpargaonkar@gmail.com 2010-02-08 16:58:04 UTC
Can you,

1. load cifs module
2. disable unix extensions (echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled)
3. mount a cifs share with nocase option

and then see whether you can access a file in a case insensitive way?

With POSIX semantics, it overrides Case Sensitivity
Comment 3 shirishpargaonkar@gmail.com 2010-02-12 12:23:33 UTC
Created attachment 5338 [details]
patch to indicate server about file names case sensitivity

Include Case Sensitivity flag in smb header's flag field in case of mount
with nocase option.
Comment 4 shirishpargaonkar@gmail.com 2010-02-12 12:28:18 UTC
This patch is necessary but inspite of this patch, Samba server still fails a 
NT Create AndX request for a case insensitive file with an error  
Comment 5 shirishpargaonkar@gmail.com 2010-02-12 14:00:34 UTC
This is the error I see on Samba server (the file name on server is File2)

[2010/02/12 13:50:49,  5] smbd/open.c:1525(open_file_ntcreate)
  open_file_ntcreate: FILE_OPEN requested for file file2 and file doesn't exist.
[2010/02/12 13:50:49,  5] smbd/files.c:407(file_free)
  freed files structure 9535 (0 used)
[2010/02/12 13:50:49, 10] smbd/open.c:3131(create_file_unixpath)
  create_file_unixpath: NT_STATUS_OBJECT_NAME_NOT_FOUND
Comment 6 Jeff Layton 2012-04-28 00:28:25 UTC
Reassigning to Shirish since he's done most of the legwork here. Shirish, should
we convert this to a bug against samba server in light of your last comment? Was there a reason you decided not to send the attached patch upstream?
Comment 7 shirishpargaonkar@gmail.com 2012-04-28 03:17:56 UTC
(In reply to comment #6)

Jeff, let me revisit/reread this bug, I probably would not be able to do
this for a week or so, will update as soon as I can. Thanks.
Comment 8 shirishpargaonkar@gmail.com 2012-05-14 03:42:05 UTC
I am confused.  With this Samba server,

Version 3.6.0-GIT-UNKNOWN-devel

case (default) and nocase options seem to be working the same
i.e. with the patch, with nothing specified and with nocase specified,
I am able to create and cat files under <mount_dir>/MENU as well as 
I would have expected with a direcotry <share_path>/MENU, with 
default option (i.e. no mount option), user would not be able to
create and cat files under <mount_dir>/menu.
Comment 9 shirishpargaonkar@gmail.com 2012-05-14 05:27:20 UTC
I think this bug should be closed. nocase mount option is working as desired
and designed.  Please note otherwise.
If not responded, this bug should be closed in a month or so (by (6/15/12).
Comment 10 Jeff Layton 2012-05-14 10:33:04 UTC
Closing as FIXED per Shirish's request. Thanks, Shirish!