New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling statement OR assignment continuation '\' on Win32 platform #55461
Comments
Referring to URL for files used to build the Apache Portable Runtime Utilities library using Python 2.7.1(AMD64) or 2.6.5(Cygwin) on a Win32 system (Windows 7), when apr/build/gen-build.py (http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/build/gen-build.py?revision=886996&view=markup) parses '\' on line 96 and 97 in apr-util/build.conf (http://svn.apache.org/viewvc/apr/apr-util/branches/1.4.x/build.conf?revision=886996&view=markup), it recognizes them as separate tokens causing the script to fail on line 168 "assert file[-2:] == '.c'". If the line continuation notation ('\') is removed from build.conf, gen-build.py performs without errors. On a Redhat Linux, I have verified Python 2.5.5 (and trust 2.7.1 to provide the same behavior on Linux) handles '\' without errors leading me to believe that if this is a bug, it is only on Win32 platform (and instances where '\' is used for directory path separation). I am new to Python, from searching the python bug database, I have not been able to find the above condition covered. If this bug has already been identified, please disregard. |
Why do you think this is a bug in Python as opposed to one in the script parsing the .conf file? |
If the defect was with the script, the failure to bypass the '\' notation would have to be true on Redhat Linux. Since build.conf with '\' notation gets parsed without errors on Redhat Linux, I am under the impression the parsing performed by Python on Win32 recognizes '\' as a legitimate file token resulting in the script to fail. In summary, I view semantics of '\' being different in Win32 vs. Linux as an inconsistency and hence thought it to be a possible defect in Python. However, if Python scripts do not guarantee platform independence, i.e, one's scripts need to be cognizant of platform idiosyncrasy, then, I believe it is not a bug in Python. |
Unfortunately the bug is not in ConfigParser but rather in your gen-build.py. There is nothing special about backslashes and ConfigParser reads them in as part of the value for ldap/paths. But then look what happens in gen-build.py:215. The ['ldap/apr_ldap_init.c', '\\', 'ldap/apr_ldap_option.c', '\\', 'ldap/apr_ldap_rebind.c'] and later on the So, the easiest fix for you is to get rid of the backslashes from the configuration file. They work on Linux by mere coincidence. |
Yes, the easier fix is to change build.conf file to not use '\'. However,
is more definite compared to
|
lukasz.langa, confirming the difference in return values for glob.glob() on Win32/Cygwin vs. Linux as the following results show: -------------------------------------------------------- F1()
ret_val1
F2(ret_val1)
ret_val2 --
|
OK, now I know more about glob than I ever wanted to! :) Basically it comes down to this: unix>>> os.path.split('\\')
('', '\\')
win32>>> os.path.split('\\')
('\\', '') This is why \ is recognized as the root directory on Win32 and as a non-existent file on Unix. In case of / both Unix and Win32 treat it as a valid directory separator so Does this answer your questions? |
Thanks for the education (hopefully a slight detour for you 8-). I included '/' to convey uniform behavior across platforms. I will take it that the difference in what os.path.split() returns on Win32 vs. Linux is not a bug in Python since its Win32 users have come to expect the response it gives ? if yes, please point me to a resource (i.e, if you are aware, else do not bother 8-) that identifies such other conundrums. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: