lkml.org 
[lkml]   [2015]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectDetection of case senstive filenames
Date
There are several files in Linux whose names only differ by capitalization.   This has caused us some support issues due to third party filesystems/revision control systems, which overwrite the wrong file, causing non-obvious compilation errors.   I recently added a more obvious compile time failure to some of these files to reduce the number of support calls we get on the subject.   I thought I'd bring it up in case someone thinks it might be a good idea to move this to the mainstream kernel.   The code is:

/* if your compiler generates an error here, it is likely due to a filename-capitalization error, caused by a case-insensitive filesystem or revision control system */
#define __CHECK_FILENAME(filename) \
static int __checkfname __attribute__((unused)) = (1/((__builtin_strcmp((__FILE__ + __builtin_strlen(__FILE__) - __builtin_strlen(filename)), filename))?0:1))
__CHECK_FILENAME("xt_dscp.c");

(This would appear at the bottom of xt_DSCP.c, xt_dscp.c, etc. in global scope). While not overly pretty, it does point out what the actual error is, and doesn't have any side-effects. If there's interest, let me know and I can try to push it upstream.


John



\
 
 \ /
  Last update: 2015-05-29 21:41    [W:0.030 / U:0.924 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site