Monday, May 18, 2009

File Names and Paths with Linux

Linux is a case-sensitive operating system which can cause problems when opening tables from a Windows or DOS based application. The path must be passed in with the same case as it is stored on the Linux file system. This isn't an issue with Windows based applications so paths and table names are usually written using mixed case during development.

There is a configuration option called LOWERCASE_ALL_PATHS for the Advantage Database Server for Linux which causes the server to change any path or table name to all lower case prior to opening the requested table. This is an integer value 0 for false and 1 for true. The default is 0 meaning that the path will be used tried exactly as it is sent to the server.

The files must be stored in the file system with all lower case names for this to work. The following script will change all of the filenames in the current directory to all lower case. Remember that the directory names must also be in all lower case as well. From a terminal window change to the directory which contains your tables and type the following command on a single line.

find -type f | while read i; do j="`echo $i | tr [[:upper:]] [[:lower:]]`"; [ "$j" != "$i" ] && { mv "$i" "$j" || echo "ERROR: $i"; } ; done

By setting LOWERCASE_ALL_PATHS to true all files created by the server will always be created in all lower case. This ensures that a newly created file will be accessible to the client(s). This applies to any Create Table, Create Index, Backup and Restore operations.

If your application supports both Windows and Linux servers you should take care when naming your files. You can use the following SAMBA settings to ensure that files copied from Windows will be written in Linux using all lower case. Add or change the following settings in the /etc/samba/smb.conf file:

case sensitive = yes
preserve case = no
short preserve case = no
default case = lower

With these settings all files copied from a Windows client to the Linux server through SAMBA will be written in all lower case. Using these settings along with LOWERCASE_ALL_PATHS should avoid any 5004, 7008, 7041 and 7077 errors due to file case issues.

2 comments:

Steve said...

I'm receiving an Error 7078 when trying to disconnect a user in 9.0 (not receiving same error in 8.1). I looked in the error log, and also saw error 7041...so I changed the server name from //dc to //DC but still didn't help. I'm an administrator and 8.1 didn't ask for user name and password when disconnecting a user...so what now?

Ron Christie said...

Hi Chris,

One Linux related issue I'm struggling with is as follows:

I've got an installation running ADS 10 on an Ubuntu server, and the user can instruct the application (written in Harbour, BTW) to transfer portions of one or more .dbf tables to a local workstation. I'm constantly getting the index collation mismatch error when I try this on this particular installation (Windows installs work fine). I got some advice from the newsgroup to use adsstamp to set the collation language on the server, but I can't find anything on how to set the collation sequence for the ADS local server (which is what the system is using to write the records to the local hard drive). I've searched the ADS documentation, and this website to no avail. Any chance you can write up a post on how to do this?

Thanks!