@@ -1063,12 +1063,12 @@ abstract static class ChmodNode extends PythonBuiltinNode {
10631063 private final BranchProfile gotException = BranchProfile .create ();
10641064
10651065 @ Specialization
1066- Object chmod (String path , int mode , @ SuppressWarnings ("unused" ) PNone dir_fd , @ SuppressWarnings ("unused" ) PNone follow_symlinks ) {
1066+ Object chmod (String path , long mode , @ SuppressWarnings ("unused" ) PNone dir_fd , @ SuppressWarnings ("unused" ) PNone follow_symlinks ) {
10671067 return chmod (path , mode , dir_fd , true );
10681068 }
10691069
10701070 @ Specialization
1071- Object chmod (String path , int mode , @ SuppressWarnings ("unused" ) PNone dir_fd , boolean follow_symlinks ) {
1071+ Object chmod (String path , long mode , @ SuppressWarnings ("unused" ) PNone dir_fd , boolean follow_symlinks ) {
10721072 Set <PosixFilePermission > permissions = modeToPermissions (mode );
10731073 try {
10741074 TruffleFile truffleFile = getContext ().getEnv ().getTruffleFile (path );
@@ -1086,10 +1086,10 @@ Object chmod(String path, int mode, @SuppressWarnings("unused") PNone dir_fd, bo
10861086 }
10871087
10881088 @ TruffleBoundary (allowInlining = true )
1089- private static Set <PosixFilePermission > modeToPermissions (int mode ) {
1090- Set <PosixFilePermission > permissions = new HashSet <>(Arrays .asList (otherBitsToPermission [mode & 7 ]));
1091- permissions .addAll (Arrays .asList (groupBitsToPermission [mode >> 3 & 7 ]));
1092- permissions .addAll (Arrays .asList (ownerBitsToPermission [mode >> 6 & 7 ]));
1089+ private static Set <PosixFilePermission > modeToPermissions (long mode ) {
1090+ Set <PosixFilePermission > permissions = new HashSet <>(Arrays .asList (otherBitsToPermission [( int ) ( mode & 7 ) ]));
1091+ permissions .addAll (Arrays .asList (groupBitsToPermission [( int ) ( mode >> 3 & 7 ) ]));
1092+ permissions .addAll (Arrays .asList (ownerBitsToPermission [( int ) ( mode >> 6 & 7 ) ]));
10931093 return permissions ;
10941094 }
10951095 }
0 commit comments