Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
df9c2c2a
Kaydet (Commit)
df9c2c2a
authored
Agu 24, 2005
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #1262036: Make tarfile name absolute. Fixes #1257255.
üst
6f9e3ca5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
20 deletions
+9
-20
tarfile.py
Lib/tarfile.py
+7
-20
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/tarfile.py
Dosyayı görüntüle @
df9c2c2a
...
@@ -800,7 +800,7 @@ class TarFile(object):
...
@@ -800,7 +800,7 @@ class TarFile(object):
can be determined, `mode' is overridden by `fileobj's mode.
can be determined, `mode' is overridden by `fileobj's mode.
`fileobj' is not closed, when TarFile is closed.
`fileobj' is not closed, when TarFile is closed.
"""
"""
self
.
name
=
name
self
.
name
=
os
.
path
.
abspath
(
name
)
if
len
(
mode
)
>
1
or
mode
not
in
"raw"
:
if
len
(
mode
)
>
1
or
mode
not
in
"raw"
:
raise
ValueError
,
"mode must be 'r', 'a' or 'w'"
raise
ValueError
,
"mode must be 'r', 'a' or 'w'"
...
@@ -812,7 +812,7 @@ class TarFile(object):
...
@@ -812,7 +812,7 @@ class TarFile(object):
self
.
_extfileobj
=
False
self
.
_extfileobj
=
False
else
:
else
:
if
self
.
name
is
None
and
hasattr
(
fileobj
,
"name"
):
if
self
.
name
is
None
and
hasattr
(
fileobj
,
"name"
):
self
.
name
=
fileobj
.
name
self
.
name
=
os
.
path
.
abspath
(
fileobj
.
name
)
if
hasattr
(
fileobj
,
"mode"
):
if
hasattr
(
fileobj
,
"mode"
):
self
.
mode
=
fileobj
.
mode
self
.
mode
=
fileobj
.
mode
self
.
_extfileobj
=
True
self
.
_extfileobj
=
True
...
@@ -948,22 +948,18 @@ class TarFile(object):
...
@@ -948,22 +948,18 @@ class TarFile(object):
raise
CompressionError
,
"gzip module is not available"
raise
CompressionError
,
"gzip module is not available"
pre
,
ext
=
os
.
path
.
splitext
(
name
)
pre
,
ext
=
os
.
path
.
splitext
(
name
)
pre
=
os
.
path
.
basename
(
pre
)
if
ext
==
".tgz"
:
if
ext
==
".tgz"
:
ext
=
".tar"
ext
=
".tar"
if
ext
==
".gz"
:
if
ext
==
".gz"
:
ext
=
""
ext
=
""
tarname
=
pre
+
ext
tarname
=
os
.
path
.
basename
(
pre
+
ext
)
if
fileobj
is
None
:
if
fileobj
is
None
:
fileobj
=
file
(
name
,
mode
+
"b"
)
fileobj
=
file
(
name
,
mode
+
"b"
)
if
mode
!=
"r"
:
name
=
tarname
try
:
try
:
t
=
cls
.
taropen
(
tar
name
,
mode
,
t
=
cls
.
taropen
(
name
,
mode
,
gzip
.
GzipFile
(
name
,
mode
,
compresslevel
,
fileobj
)
gzip
.
GzipFile
(
tar
name
,
mode
,
compresslevel
,
fileobj
)
)
)
except
IOError
:
except
IOError
:
raise
ReadError
,
"not a gzip file"
raise
ReadError
,
"not a gzip file"
...
@@ -984,19 +980,11 @@ class TarFile(object):
...
@@ -984,19 +980,11 @@ class TarFile(object):
except
ImportError
:
except
ImportError
:
raise
CompressionError
,
"bz2 module is not available"
raise
CompressionError
,
"bz2 module is not available"
pre
,
ext
=
os
.
path
.
splitext
(
name
)
pre
=
os
.
path
.
basename
(
pre
)
if
ext
==
".tbz2"
:
ext
=
".tar"
if
ext
==
".bz2"
:
ext
=
""
tarname
=
pre
+
ext
if
fileobj
is
not
None
:
if
fileobj
is
not
None
:
raise
ValueError
,
"no support for external file objects"
raise
ValueError
,
"no support for external file objects"
try
:
try
:
t
=
cls
.
taropen
(
tar
name
,
mode
,
bz2
.
BZ2File
(
name
,
mode
,
compresslevel
=
compresslevel
))
t
=
cls
.
taropen
(
name
,
mode
,
bz2
.
BZ2File
(
name
,
mode
,
compresslevel
=
compresslevel
))
except
IOError
:
except
IOError
:
raise
ReadError
,
"not a bzip2 file"
raise
ReadError
,
"not a bzip2 file"
t
.
_extfileobj
=
False
t
.
_extfileobj
=
False
...
@@ -1203,8 +1191,7 @@ class TarFile(object):
...
@@ -1203,8 +1191,7 @@ class TarFile(object):
arcname
=
name
arcname
=
name
# Skip if somebody tries to archive the archive...
# Skip if somebody tries to archive the archive...
if
self
.
name
is
not
None
\
if
self
.
name
is
not
None
and
os
.
path
.
samefile
(
name
,
self
.
name
):
and
os
.
path
.
abspath
(
name
)
==
os
.
path
.
abspath
(
self
.
name
):
self
.
_dbg
(
2
,
"tarfile: Skipped
%
r"
%
name
)
self
.
_dbg
(
2
,
"tarfile: Skipped
%
r"
%
name
)
return
return
...
...
Misc/NEWS
Dosyayı görüntüle @
df9c2c2a
...
@@ -63,6 +63,8 @@ Extension Modules
...
@@ -63,6 +63,8 @@ Extension Modules
Library
Library
-------
-------
-
Patch
#
1262036
:
Make
tarfile
name
absolute
.
Fixes
#
1257255.
-
Bug
#
1266283
:
"lexists"
is
now
in
os
.
path
.
__all__
.
-
Bug
#
1266283
:
"lexists"
is
now
in
os
.
path
.
__all__
.
-
The
sets
module
can
now
properly
compute
s
-=
s
and
s
^=
s
as
an
empty
set
.
-
The
sets
module
can
now
properly
compute
s
-=
s
and
s
^=
s
as
an
empty
set
.
...
...
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