mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 08:58:36 +00:00
vertex_types: ask report_paths for the report-path guard
The tool carried its own `same_output_path` (realpath, normcase, samefile) while it already imported `report_paths.path_key`, so it answered the report-path question two ways; CONTRIBUTING.md asks a report writer to ask `same_report_path` instead of deriving it again. The private copy also missed the helper's folding-volume probe, so on a Linux mount that ignores case (vfat/exFAT/CIFS) `--json R.json` and `--json r.json` were two paths and the second overwrote the first.
This commit is contained in:
committed by
Jan Trencansky
parent
83e69c1d81
commit
5175cc9188
@ -47,6 +47,7 @@ import zlib
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
from meshlet_page import PageError, parse_group # noqa: E402 (same group validation as the 63 30 pages)
|
||||
from report_paths import path_key # noqa: E402
|
||||
from report_paths import same_report_path # noqa: E402
|
||||
|
||||
MAGIC = 0x4042
|
||||
HEADER = 0x80
|
||||
@ -679,15 +680,6 @@ def summarise(T):
|
||||
return out
|
||||
|
||||
|
||||
def same_output_path(first, second):
|
||||
if os.path.normcase(os.path.realpath(first)) == os.path.normcase(os.path.realpath(second)):
|
||||
return True
|
||||
try:
|
||||
return os.path.samefile(first, second)
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def _walk_error(exc: OSError):
|
||||
# os.walk skips a directory it cannot list unless onerror raises; a scan must not report an
|
||||
# incomplete directory as complete. main() turns the OSError into one error line and exit 2.
|
||||
@ -729,7 +721,7 @@ def main(argv=None):
|
||||
print(f"error: --json {args.json} is a directory", file=sys.stderr)
|
||||
return 2
|
||||
for path in archives.values():
|
||||
if same_output_path(args.json, path):
|
||||
if same_report_path(args.json, path):
|
||||
print(f"error: --json would overwrite the input {path}", file=sys.stderr)
|
||||
return 2
|
||||
rng = random.Random(args.seed)
|
||||
|
||||
Reference in New Issue
Block a user