You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jeff Whiting (JIRA)" <ji...@apache.org> on 2010/10/13 23:58:32 UTC
[jira] Commented: (THRIFT-955) Thrift compiler for Windows uses
lowercase names and directories which is inconsistent with compiling on
other platforms
[ https://issues.apache.org/jira/browse/THRIFT-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920780#action_12920780 ]
Jeff Whiting commented on THRIFT-955:
-------------------------------------
Looking at main.cc you see the following code:
{noformat}
/**
* MinGW doesn't have realpath, so use fallback implementation in that case,
* otherwise this just calls through to realpath
*/
char *saferealpath(const char *path, char *resolved_path) {
#ifdef MINGW
char buf[MAX_PATH];
char* basename;
DWORD len = GetFullPathName(path, MAX_PATH, buf, &basename);
if (len == 0 || len > MAX_PATH - 1){
strcpy(resolved_path, path);
} else {
CharLowerBuff(buf, len);
strcpy(resolved_path, buf);
}
// Replace backslashes with forward slashes so the
// rest of the code behaves correctly.
size_t resolved_len = strlen(resolved_path);
for (size_t i = 0; i < resolved_len; i++) {
if (resolved_path[i] == '\\') {
resolved_path[i] = '/';
}
}
return resolved_path;
#else
return realpath(path, resolved_path);
#endif
}
{noformat}
The code calls CharLowerBuff(buf, len); which would lowercase the entire path. I can't think of any reason to lowercase the result of GetFullPathName as that function should have returned to you the correct path with the correct case. I haven't tested removing that line of code but I bet it would fix this bug.
> Thrift compiler for Windows uses lowercase names and directories which is inconsistent with compiling on other platforms
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-955
> URL: https://issues.apache.org/jira/browse/THRIFT-955
> Project: Thrift
> Issue Type: Bug
> Components: PHP - Compiler
> Affects Versions: 0.5
> Environment: Windows 7 64 bit. Using thrift compiler for windows found at: http://incubator.apache.org/thrift/download/
> Reporter: Jeff Whiting
>
> Using thrift compiler 0.5.0 for windows found at: http://incubator.apache.org/thrift/download/ the compiler produces lowercase files and paths rather than honoring the capitalization of the thrift file. However using the compiler on other platforms (I've tested OS X specifically), or an older compiler for windows found on the wiki, the name follows the capitalization of the thrift file.
> Windows compiler now compiling AdminService.thrift you get:
> ./gen-php/adminservice/adminservice_constants.php
> ./gen-php/adminservice/adminservice_types.php
> ./gen-php/adminservice/AdminService.php
> What you get on other OSes and what you used to get on older versions of windows compiler:
> ./gen-php/AdminService/AdminService_constants.php
> ./gen-php/AdminService/AdminService_types.php
> ./gen-php/AdminService/AdminService.php
> This is an inconsistency that can cause lots of headaches for developers when they are in a mixed environment using both windows and other OSes to compile thrift files. It makes it easy to get the wrong case and can cause problems for a case sensitive file system. It seems that the compiler should behave the same regardless of the platform.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.