Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture error messages from git-annex's JSON output #3751

Merged
merged 4 commits into from
Oct 10, 2019

Conversation

mih
Copy link
Member

@mih mih commented Oct 5, 2019

Turns this:

% datalad save
add(error): that3 (file)

into

% datalad save
add(error): that3 (file) [  that3: setFileMode: permission denied (Operation not permitted)]

hence fixes gh-3685

Note that this does not fix the same issue in add(), because different code is used (see gh-3714).

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember adding a test on operations when permissions are wrong (grep for sudo?). Might be a good sport to add a check

@@ -2060,7 +2060,7 @@ def _run_annex_command_json(self, command,
log_online=True
))
# TODO: refactor to account for possible --batch ones
annex_options = ['--json']
annex_options = ['--json', '--json-error-messages']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would need to check from which version of annex it was introduced (I still have vague memory asking for it so it might have been not too long ago) and possibly boost our minimal annex version requirement accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mih
Copy link
Member Author

mih commented Oct 5, 2019

I failed to come up with a test that isnt insanely complex across test setups, otherwise I would have added one. If you consider this a showstopper, please contribute.

@yarikoptic
Copy link
Member

Test is Not a show stopper but very nice to have. Grep for sudo lead me to

# Assure that regardless of umask everyone could read it all

I could look later when I get to the laptop which line or two to add

@codecov
Copy link

codecov bot commented Oct 6, 2019

Codecov Report

Merging #3751 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3751      +/-   ##
==========================================
+ Coverage   82.92%   82.93%   +<.01%     
==========================================
  Files         273      273              
  Lines       35942    35961      +19     
==========================================
+ Hits        29804    29823      +19     
  Misses       6138     6138
Impacted Files Coverage Δ
datalad/interface/utils.py 88.32% <ø> (ø) ⬆️
datalad/support/gitrepo.py 84.65% <100%> (+0.01%) ⬆️
datalad/support/annexrepo.py 63.51% <100%> (+0.03%) ⬆️
datalad/support/tests/test_annexrepo.py 96.38% <100%> (+0.04%) ⬆️
datalad/log.py 65.86% <0%> (-0.97%) ⬇️
datalad/customremotes/base.py 78.31% <0%> (+0.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c077fac...582bb51. Read the comment docs.

In order to be able to capture any error messages as part of the
JSON-lines output. Precondition for dataladgh-3685
Turn this:

```
% datalad save
add(error): that3 (file)
```

into

```
% datalad save
add(error): that3 (file) [  that3: setFileMode: permission denied (Operation not permitted)]
```

hence fixes dataladgh-3685
@mih
Copy link
Member Author

mih commented Oct 10, 2019

Test is in. Test passes. Merging....

@mih mih merged commit 25fa995 into datalad:master Oct 10, 2019
@mih mih deleted the bf-jsonerror branch October 10, 2019 11: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.

save provides no details for an error (in case of permission issues)
2 participants