mountpoint detection: wrong marker path, and requestedCount stops one short #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two defects in
findDCFMountPoints(pkg/dcf/helpers.go), found while bringing the repo to standards. Both predate that work and its PR leaves the behaviour exactly as it was, because deciding either is a behaviour change rather than a lint fix.1. The marker directory checked is
M4ROOT, notPRIVATE/M4ROOT.The original code computed
filepath.Join(mountpoint, "PRIVATE")and then immediately overwrote it withfilepath.Join(mountpoint, "M4ROOT"), so only the second was ever stat'd. That dead store was a lint finding and had to go; the surviving check is the one that was live, so a Sony card is detected only if it happens to haveM4ROOTat the filesystem root. README and the spec both say the directory isPRIVATE/M4ROOT.2.
requestedCountreturns one fewer store than asked for.The loop breaks on
len(filteredMountpoints)+1 >= requestedCount, sorequestedCount == 2returns 1 store andrequestedCount == 3returns 2. OnlyrequestedCount == 1and0(all) behave as documented.Both want a decision about intended behaviour, plus a test each.