This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: AT_FDCWD is 0xffd19553 on Solaris 10, resulting in compiler warnings.
Type: compile error Stage: needs patch
Components: Build Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: trent Nosy List: larry, python-dev, trent
Priority: normal Keywords:

Created on 2012-09-18 15:12 by trent, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg170648 - (view) Author: Trent Nelson (trent) * (Python committer) Date: 2012-09-18 15:12
On Solaris (s10/nitrogen):


% find /usr/include -type f | xargs fgrep -ni AT_FDCWD
/usr/include/sys/fcntl.h:320:#define    AT_FDCWD                        0xffd19553

(AIX uses -2, FreeBSD uses -100.)

Anyway, that results in:


(cpython@nitrogen:ttypts/10) (Tue/15:34) ..                                                                                                         (~/hg/3.x.trent/build/release)
% touch ../../src/Modules/posixmodule.c 
(cpython@nitrogen:ttypts/10) (Tue/15:34) ..                                                                                                         (~/hg/3.x.trent/build/release)
% time /usr/ccs/bin/make 
/opt/solarisstudio12.3/bin/cc  -DNDEBUG -v -m64 -mt=yes -xbuiltin -xhwcprof -xF -xarch=native -xchip=native -fast -fma=fused -g -xO4 -library=sunperf   -I. -I../../src/Include -IInclude   -DPy_BUILD_CORE  -c ../../src/Modules/posixmodule.c -o Modules/posixmodule.o
"../../src/Modules/posixmodule.c", line 2307: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 2337: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 2386: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 2626: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 2966: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 3198: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 3199: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 3845: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 3989: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 3990: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 4111: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 4267: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 4587: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 7007: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 7092: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 7510: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 8260: warning: initializer does not fit or is out of range: 0xffd19553
"../../src/Modules/posixmodule.c", line 8322: warning: initializer does not fit or is out of range: 0xffd19553
^C
*** Modules/posixmodule.o removed.
/usr/ccs/bin/make  2.79s user 0.28s system 46% cpu 6.598 total

In every case, the affected line is:

    int dir_fd = DEFAULT_DIR_FD;

(DEFAULT_DIR_FD defaults to AT_FDCWD if it's defined.)

Note that Solaris 10 64-bit is LP64, ints are still 32-bit.
msg170649 - (view) Author: Trent Nelson (trent) * (Python committer) Date: 2012-09-18 15:32
Easy fix, cast AT_FDCWD to (int):


% hg diff
diff -r 3a880d640981 Modules/posixmodule.c
--- a/Modules/posixmodule.c     Tue Sep 18 07:21:18 2012 +0300
+++ b/Modules/posixmodule.c     Tue Sep 18 16:04:58 2012 +0000
@@ -414,7 +414,14 @@
 
 
 #ifdef AT_FDCWD
-#define DEFAULT_DIR_FD AT_FDCWD
+/*
+ * Why the (int) cast?  Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965);
+ * without the int cast, the value gets interpreted as uint (4291925331),
+ * which doesn't play nicely with all the initializer lines in this file that
+ * look like this:
+ *      int dir_fd = DEFAULT_DIR_FD;
+ */
+#define DEFAULT_DIR_FD (int)AT_FDCWD
 #else
 #define DEFAULT_DIR_FD (-100)
 #endif


The cast is harmless on other platforms that use an actual integer (rather than a hex representation).

Any objections?
msg170665 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2012-09-18 19:18
Lgtm. 

Trent Nelson <report@bugs.python.org> wrote:

>
>Trent Nelson added the comment:
>
>Easy fix, cast AT_FDCWD to (int):
>
>
>% hg diff
>diff -r 3a880d640981 Modules/posixmodule.c
>--- a/Modules/posixmodule.c     Tue Sep 18 07:21:18 2012 +0300
>+++ b/Modules/posixmodule.c     Tue Sep 18 16:04:58 2012 +0000
>@@ -414,7 +414,14 @@
> 
> 
> #ifdef AT_FDCWD
>-#define DEFAULT_DIR_FD AT_FDCWD
>+/*
>+ * Why the (int) cast?  Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965);
>+ * without the int cast, the value gets interpreted as uint (4291925331),
>+ * which doesn't play nicely with all the initializer lines in this file that
>+ * look like this:
>+ *      int dir_fd = DEFAULT_DIR_FD;
>+ */
>+#define DEFAULT_DIR_FD (int)AT_FDCWD
> #else
> #define DEFAULT_DIR_FD (-100)
> #endif
>
>
>The cast is harmless on other platforms that use an actual integer (rather than a hex representation).
>
>Any objections?
>
>----------
>
>_______________________________________
>Python tracker <report@bugs.python.org>
><http://bugs.python.org/issue15965>
>_______________________________________
msg170696 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-09-19 01:50
New changeset 974a4cae6094 by Trent Nelson in branch 'default':
#15965: Explicitly cast AT_FDCWD as (int).
http://hg.python.org/cpython/rev/974a4cae6094
History
Date User Action Args
2022-04-11 14:57:36adminsetgithub: 60169
2012-09-19 02:20:40trentsetstatus: open -> closed
resolution: fixed
2012-09-19 01:50:27python-devsetnosy: + python-dev
messages: + msg170696
2012-09-18 21:30:20Arfreversettitle: AT_FDCWD is 0xffd19553 on Solaris 10, resulting in compiler warnings. -> AT_FDCWD is 0xffd19553 on Solaris 10, resulting in compiler warnings.
2012-09-18 19:18:09larrysetmessages: + msg170665
title: AT_FDCWD is 0xffd19553 on Solaris 10, resulting in compiler warnings. -> AT_FDCWD is 0xffd19553 on Solaris 10, resulting in compiler warnings.
2012-09-18 15:32:07trentsetmessages: + msg170649
2012-09-18 15:16:06r.david.murraysetnosy: + larry
2012-09-18 15:12:51trentcreate