S2 stat-says-missing: mesh-files stat says a path root finds missing does not exist
Issue 1409. A stat through root of a path that is not there answered that the file modes refuse it; it says it does not exist, so design 39 parts §15's "gone" can be read. Builds: design 39 parts D3 (§15), bullet 3
This commit is contained in:
@@ -711,6 +711,11 @@ func TestTheReadsFallBackToRoot(t *testing.T) {
|
||||
if ls, err := g.List(secretDir); err != nil || ls.Secret == "" || len(ls.Entries) != 1 || ls.Entries[0].Name != "id_rsa" {
|
||||
t.Errorf("a secret place was not listed through root: %+v %v", ls, err)
|
||||
}
|
||||
g.root.fail = map[string]error{"/usr/bin/stat -c " + statFormat + " -- " + in + "/gone": errors.New(
|
||||
"sudo -n /usr/bin/stat: stat: cannot statx '" + in + "/gone': No such file or directory")}
|
||||
if st, err := g.Stat([]string{in + "/gone"}, false); err != nil || !strings.Contains(st.Paths[0].Stopped, "does not exist") {
|
||||
t.Errorf("a missing path under a closed directory: %+v %v", st, err)
|
||||
}
|
||||
g.root.calls = nil
|
||||
if _, err := g.Read(locked+"/.ssh/id_rsa", ReadAsk{}); err == nil || len(g.root.calls) != 0 {
|
||||
t.Errorf("a credential file was read: %v %v", err, g.root.calls)
|
||||
|
||||
@@ -314,6 +314,10 @@ var rootTypes = map[string]string{"regular file": "file", "regular empty file":
|
||||
func (r Reader) componentAsRoot(p string, names accounts, mounts map[string]Mount) (Component, bool) {
|
||||
out, err := r.Root.Run("/usr/bin/stat", "-c", statFormat, "--", p)
|
||||
f := strings.Split(strings.TrimSpace(string(out)), "|")
|
||||
if err != nil && strings.Contains(err.Error(), "No such file or directory") {
|
||||
// root reached the place and it is not there: said as missing, not as refused by the file modes.
|
||||
return Component{Path: p, Unreachd: why(fs.ErrNotExist)}, true
|
||||
}
|
||||
if err != nil || len(f) != 6 {
|
||||
return Component{}, false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user