Commit 66baffe
committed
Resolve symlink issue.
If there is certain symlink in the container image like this:
/A --> /X/Y/Z
AND if the "/X/Y/Z" doesn't exists on the host OS, then the current
invocation to os.Stat will give errors saying that the "Could not
obtain size for /X/Y/Z". This is because that it will follow the
link to check the /X/Y/Z on the host. That is improper.
The proper behaviour should be:
From the perspective of the symlink inside the container image, the
valid target file it pointing to is always some "existing file" in
the container image.
From the perspective of the host OS, it should just respect the
"closure" of the file system inside the container image.
To resolve it, instead of the os.Stat, we can use os.Lstat which
will not follow the link to check the target file.
Signed-off-by: zhongjie <[email protected]>1 parent e191f5b commit 66baffe
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
| 152 | + | |
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| |||
0 commit comments