Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8bc462fc
Commit
8bc462fc
authored
Oct 20, 2004
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Patch #1043972, for bug #1017553] filemode() returns an incorrect value for the mode 07111
parent
d4f2552e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
27 deletions
+34
-27
Lib/tarfile.py
Lib/tarfile.py
+34
-27
No files found.
Lib/tarfile.py
View file @
8bc462fc
...
...
@@ -174,39 +174,46 @@ def copyfileobj(src, dst, length=None):
return
filemode_table
=
(
(
S_IFLNK
,
"l"
,
S_IFREG
,
"-"
,
S_IFBLK
,
"b"
,
S_IFDIR
,
"d"
,
S_IFCHR
,
"c"
,
S_IFIFO
,
"p"
),
(
TUREAD
,
"r"
),
(
TUWRITE
,
"w"
),
(
TUEXEC
,
"x"
,
TSUID
,
"S"
,
TUEXEC
|
TSUID
,
"s"
),
(
TGREAD
,
"r"
),
(
TGWRITE
,
"w"
),
(
TGEXEC
,
"x"
,
TSGID
,
"S"
,
TGEXEC
|
TSGID
,
"s"
),
(
TOREAD
,
"r"
),
(
TOWRITE
,
"w"
),
(
TOEXEC
,
"x"
,
TSVTX
,
"T"
,
TOEXEC
|
TSVTX
,
"t"
))
((
S_IFLNK
,
"l"
),
(
S_IFREG
,
"-"
),
(
S_IFBLK
,
"b"
),
(
S_IFDIR
,
"d"
),
(
S_IFCHR
,
"c"
),
(
S_IFIFO
,
"p"
)),
((
TUREAD
,
"r"
),),
((
TUWRITE
,
"w"
),),
((
TUEXEC
|
TSUID
,
"s"
),
(
TSUID
,
"S"
),
(
TUEXEC
,
"x"
)),
((
TGREAD
,
"r"
),),
((
TGWRITE
,
"w"
),),
((
TGEXEC
|
TSGID
,
"s"
),
(
TSGID
,
"S"
),
(
TGEXEC
,
"x"
)),
((
TOREAD
,
"r"
),),
((
TOWRITE
,
"w"
),),
((
TOEXEC
|
TSVTX
,
"t"
),
(
TSVTX
,
"T"
),
(
TOEXEC
,
"x"
))
)
def
filemode
(
mode
):
"""Convert a file's mode to a string of the form
-rwxrwxrwx.
Used by TarFile.list()
"""
s
=
""
for
t
in
filemode_table
:
while
True
:
if
mode
&
t
[
0
]
==
t
[
0
]:
s
+=
t
[
1
]
elif
len
(
t
)
>
2
:
t
=
t
[
2
:]
continue
else
:
s
+=
"-"
break
return
s
perm
=
[]
for
table
in
filemode_table
:
for
bit
,
char
in
table
:
if
mode
&
bit
==
bit
:
perm
.
append
(
char
)
break
else
:
perm
.
append
(
"-"
)
return
""
.
join
(
perm
)
if
os
.
sep
!=
"/"
:
normpath
=
lambda
path
:
os
.
path
.
normpath
(
path
).
replace
(
os
.
sep
,
"/"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment