Skip to content

Commit

Permalink
Merge pull request #279 from FNALssi/readonly_patch_fnal_develop
Browse files Browse the repository at this point in the history
readonly patch part 2
  • Loading branch information
gartung authored Jan 19, 2024
2 parents b3b3768 + a60c71b commit bddc1ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/spack/spack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def _write_section(self, section):
else:
raise ConfigFileError(f"cannot write to '{filename}'") from e


def clear(self):
"""Empty cached config information."""
self.sections = syaml.syaml_dict()
Expand Down Expand Up @@ -288,7 +289,11 @@ def _write_section(self, section):
rename(tmp, self.path)

except (syaml.SpackYAMLError, IOError) as e:
raise ConfigFileError(f"cannot write to config file {str(e)}") from e
if hasattr(e, 'errno') and e.errno in [13, 30]:
tty.warn("Ignoring write error on readonly %s" % filename)
else:
raise ConfigFileError(f"cannot write to '{filename}'") from e


def __repr__(self):
return "<SingleFileScope: %s: %s>" % (self.name, self.path)
Expand Down

0 comments on commit bddc1ee

Please sign in to comment.