Skip to content

Conversation

@chrisburr
Copy link
Member

@chrisburr chrisburr commented Jan 29, 2026

New PR for #8439 which was merged too early.

Summary

  • Return error dictionaries with errno codes from exists() and getFileMetadata() in GFAL2_StorageBase
  • Captures gfal2.GError separately to extract the e.code (errno)
  • Allows consumers to distinguish between different error types (e.g., ENOENT vs EACCES)

See: https://gitlab.cern.ch/lhcb-dirac/LHCbDIRAC/-/merge_requests/1870

Motivation

When a storage element returns HTTP 401 (Permission Denied / Authentication Error), dirac-dms-check-fc2se incorrectly reports files as "missing at SEs". This is because all files in metadata["Failed"] are treated as "not existing" regardless of the actual error type.

By returning structured error information with errno codes, downstream code can properly handle permission denied errors separately from file-not-found errors, avoiding false positives.

Changes

The error format changes from:

failed[url] = repr(e)  # string

to:

failed[url] = {"error": repr(e), "errno": e.code}  # dict with errno

Backward Compatibility

Downstream code should handle both the old string format and new dict format during the transition period:

if isinstance(err_info, dict):
    err_code = err_info.get("errno")
else:
    err_code = None  # Legacy string format

BEGINRELEASENOTES

*DataManagement
CHANGE: Expose type of error from GFAL2_StorageBase.getFileMetadata

ENDRELEASENOTES

Return error dictionaries with errno codes from exists() and
getFileMetadata() to allow consumers to distinguish between different
error types (e.g., ENOENT vs EACCES).

This enables downstream code to properly handle permission denied errors
separately from file-not-found errors, avoiding false positives when
checking file existence at storage elements.
@fstagni fstagni requested a review from chaen January 30, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant