Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
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
docker-py
Commits
de88ab39
Unverified
Kaydet (Commit)
de88ab39
authored
Ock 30, 2018
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ock 30, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1880 from docker/1841-tar-broken-symlinks
Do not break when archiving broken symlinks
üst
4ff29624
4e343003
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
utils.py
docker/utils/utils.py
+2
-1
utils_test.py
tests/unit/utils_test.py
+26
-0
No files found.
docker/utils/utils.py
Dosyayı görüntüle @
de88ab39
...
@@ -98,7 +98,8 @@ def create_archive(root, files=None, fileobj=None, gzip=False):
...
@@ -98,7 +98,8 @@ def create_archive(root, files=None, fileobj=None, gzip=False):
files
=
build_file_list
(
root
)
files
=
build_file_list
(
root
)
for
path
in
files
:
for
path
in
files
:
full_path
=
os
.
path
.
join
(
root
,
path
)
full_path
=
os
.
path
.
join
(
root
,
path
)
if
not
os
.
access
(
full_path
,
os
.
R_OK
):
if
os
.
lstat
(
full_path
)
.
st_mode
&
os
.
R_OK
==
0
:
raise
IOError
(
raise
IOError
(
'Can not access file in context: {}'
.
format
(
full_path
)
'Can not access file in context: {}'
.
format
(
full_path
)
)
)
...
...
tests/unit/utils_test.py
Dosyayı görüntüle @
de88ab39
...
@@ -948,6 +948,20 @@ class TarTest(unittest.TestCase):
...
@@ -948,6 +948,20 @@ class TarTest(unittest.TestCase):
tar_data
=
tarfile
.
open
(
fileobj
=
archive
)
tar_data
=
tarfile
.
open
(
fileobj
=
archive
)
self
.
assertEqual
(
sorted
(
tar_data
.
getnames
()),
[
'bar'
,
'foo'
])
self
.
assertEqual
(
sorted
(
tar_data
.
getnames
()),
[
'bar'
,
'foo'
])
@pytest.mark.skipif
(
IS_WINDOWS_PLATFORM
,
reason
=
'No chmod on Windows'
)
def
test_tar_with_inaccessible_file
(
self
):
base
=
tempfile
.
mkdtemp
()
full_path
=
os
.
path
.
join
(
base
,
'foo'
)
self
.
addCleanup
(
shutil
.
rmtree
,
base
)
with
open
(
full_path
,
'w'
)
as
f
:
f
.
write
(
'content'
)
os
.
chmod
(
full_path
,
0
o222
)
with
pytest
.
raises
(
IOError
)
as
ei
:
tar
(
base
)
assert
'Can not access file in context: {}'
.
format
(
full_path
)
in
\
ei
.
exconly
()
@pytest.mark.skipif
(
IS_WINDOWS_PLATFORM
,
reason
=
'No symlinks on Windows'
)
@pytest.mark.skipif
(
IS_WINDOWS_PLATFORM
,
reason
=
'No symlinks on Windows'
)
def
test_tar_with_file_symlinks
(
self
):
def
test_tar_with_file_symlinks
(
self
):
base
=
tempfile
.
mkdtemp
()
base
=
tempfile
.
mkdtemp
()
...
@@ -975,6 +989,18 @@ class TarTest(unittest.TestCase):
...
@@ -975,6 +989,18 @@ class TarTest(unittest.TestCase):
sorted
(
tar_data
.
getnames
()),
[
'bar'
,
'bar/foo'
,
'foo'
]
sorted
(
tar_data
.
getnames
()),
[
'bar'
,
'bar/foo'
,
'foo'
]
)
)
@pytest.mark.skipif
(
IS_WINDOWS_PLATFORM
,
reason
=
'No symlinks on Windows'
)
def
test_tar_with_broken_symlinks
(
self
):
base
=
tempfile
.
mkdtemp
()
self
.
addCleanup
(
shutil
.
rmtree
,
base
)
for
d
in
[
'foo'
,
'bar'
]:
os
.
makedirs
(
os
.
path
.
join
(
base
,
d
))
os
.
symlink
(
'../baz'
,
os
.
path
.
join
(
base
,
'bar/foo'
))
with
tar
(
base
)
as
archive
:
tar_data
=
tarfile
.
open
(
fileobj
=
archive
)
assert
sorted
(
tar_data
.
getnames
())
==
[
'bar'
,
'bar/foo'
,
'foo'
]
@pytest.mark.skipif
(
IS_WINDOWS_PLATFORM
,
reason
=
'No UNIX sockets on Win32'
)
@pytest.mark.skipif
(
IS_WINDOWS_PLATFORM
,
reason
=
'No UNIX sockets on Win32'
)
def
test_tar_socket_file
(
self
):
def
test_tar_socket_file
(
self
):
base
=
tempfile
.
mkdtemp
()
base
=
tempfile
.
mkdtemp
()
...
...
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