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

yadm status command reports "warning: could not open directory 'Library/Calendars/': Operation not permitted" #521

Open
hybridadmin opened this issue Feb 10, 2025 · 10 comments
Labels

Comments

@hybridadmin
Copy link

Describe the bug

It appears that with the latest version 3.4.0 , yadm is somehow attempting to access files in MacOS which are not being tracked and shows a permissions error.

To reproduce

When running the command yadm status on version 3.4.0 the output is as below:

10/02/2025 09:56:07 ❯ yadm status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit (use -u to show untracked files)
warning: could not open directory 'Library/Calendars/': Operation not permitted
warning: could not open directory 'Library/Messages/': Operation not permitted
warning: could not open directory 'Library/HomeKit/': Operation not permitted
warning: could not open directory 'Library/Sharing/': Operation not permitted

Expected behavior

When running the yadm status command output should be as below:

10/02/2025 09:55:35 ❯ yadm --version
bash version 3.2.57(1)-release
 git version 2.48.1
yadm version 3.3.0

10/02/2025 09:55:00 ❯ yadm status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit (use -u to show untracked files)

Environment

Operating system: MacOS Sequoia
bash version 3.2.57(1)-release
git version 2.48.1
yadm version 3.4.0

Additional context

[Add any other context about the problem here.]

@hybridadmin hybridadmin changed the title yadm status: warning: could not open directory 'Library/Calendars/': Operation not permitted yadm status command reports "warning: could not open directory 'Library/Calendars/': Operation not permitted" Feb 10, 2025
@erijo
Copy link
Collaborator

erijo commented Feb 10, 2025

Just to confirm that the root cause is what I think it is, can you run yadm enter and then in that shell run git ls-files --others > /dev/null and see if you get the same error then.

@hybridadmin
Copy link
Author

@erijo thanks for the quick reply, I have done the above and still get the same errors:

 10/02/2025 13:08:15 ❯ yadm enter
Entering yadm repo
yadm shell (/Users/meister/.local/share/yadm/repo.git) ~ > git ls-files --others > /dev/null
warning: could not open directory 'Pictures/Photos Library.photoslibrary/': Operation not permitted
warning: could not open directory 'Library/Application Support/MobileSync/': Operation not permitted
warning: could not open directory 'Library/Application Support/CallHistoryTransactions/': Operation not permitted
warning: could not open directory 'Library/Application Support/CloudDocs/': Operation not permitted
warning: could not open directory 'Library/Application Support/com.apple.sharedfilelist/': Operation not permitted
warning: could not open directory 'Library/Application Support/Knowledge/': Operation not permitted
warning: could not open directory 'Library/Application Support/com.apple.TCC/': Operation not permitted

I have reverted to 3.3.0 for now, as that seems fine.

@erijo
Copy link
Collaborator

erijo commented Feb 10, 2025

Could you also post the content of ~/.config/yadm/encrypt?

@hybridadmin
Copy link
Author

This is what I have :

.ssh/*
!.ssh/authorized_keys
!.ssh/known_hosts*
.pwd/*
.aws/*
*.pem
.pg_service.conf
.my.secrets
.docker/config.json
.ansible.cfg
.boto
.config/gcloud
.config/kafkactl/config.yml
.config/gh/hosts.yml

erijo added a commit that referenced this issue Feb 10, 2025
This matches the behavior before 3.4.0. Also silent errors from ls-files to
avoid warnings about e.g. directories that aren't readable (#521).
@erijo
Copy link
Collaborator

erijo commented Feb 10, 2025

I've made a fix for this that's available on the parse-encrypt-fix branch. Please test that and see if it works for you (you can just download yadm from that link and run it). Besides verifying that the warning is gone, please also check that the output from yadm encrypt (i.e. the list of files being encrypted) are the same in this version and 3.3.0.

@hybridadmin
Copy link
Author

Thanks @erijo , I have tested the debug version and this seems to have fixed the original issue. However when I do a yadm encrypt some files are not being included though, e.g ~/.ssh/config , this is how my config is looking now :

.ssh/*
!.ssh/authorized_keys
!.ssh/known_hosts*
.pwd/*
.aws/*
*.pem
.pg_service.conf
.my.secrets
.docker/config.json
.ansible.cfg
.boto
.config/gcloud
.config/kafkactl/config.yml
.config/gh/hosts.yml
!.config/gcloud/logs

@erijo
Copy link
Collaborator

erijo commented Feb 11, 2025

Is .ssh/config tracked by yadm (i.e. listed if you run yadm ls-files .ssh)? If not, is it listed if you run yadm ls-files --others .ssh?

@hybridadmin
Copy link
Author

Just checked and yes it is being tracked:

 12/02/2025 09:59:44 ❯ yadm ls-files .ssh
.ssh/config

so i'm a bit stumped as to why its not being included in encrypt

@erijo
Copy link
Collaborator

erijo commented Feb 12, 2025

Files that should be encrypted should not be added to the repo as they will then be stored unencrypted by git.

As of 3.4.0 yadm uses ls-files --others to gather the list of files to encrypt, thus tracked files are no longer included. Perhaps yadm encrypt should give an error if the patterns in the encrypt file matches a tracked file?

@hybridadmin
Copy link
Author

Ah yes makes sense, so all good then. I did however get the old error when doing :

 13/02/2025 09:54:23 ❯ yadm ls-files --others
warning: could not open directory 'Pictures/Photos Library.photoslibrary/': Operation not permitted
warning: could not open directory 'Library/Application Support/MobileSync/': Operation not permitted
warning: could not open directory 'Library/Application Support/CallHistoryTransactions/': Operation not permitted
warning: could not open directory 'Library/Application Support/CloudDocs/': Operation not permitted
warning: could not open directory 'Library/Application Support/com.apple.sharedfilelist/': Operation not permitted
warning: could not open directory 'Library/Application Support/Knowledge/': Operation not permitted

but apart from this everything else seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants