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

[Bug]: Backup not created if .trash is empty #55

Closed
3 tasks done
christyray opened this issue Feb 4, 2022 · 5 comments
Closed
3 tasks done

[Bug]: Backup not created if .trash is empty #55

christyray opened this issue Feb 4, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@christyray
Copy link
Contributor

Bug Description

Thanks for the amazing workflow! When I run the obackup command, if my $vault_path/.trash folder is empty, the backup command will appear to run, but no backup is created. If the $vault_path/.trash folder is not empty, the backup is created successfully.

I believe the problem is line 16 of scripts/obsidian-backup.sh: if [[ "$itemCount" != "0" ]] ; then. It appears to evaluate to "true" even when the .trash folder is empty. When I changed line 16 to if (( ${itemCount} != 0 )) ; then, the backup worked correctly both when .trash was empty and when it had items in it.

Relevant Screenshot

No response

To Reproduce

No response

Debugging Log

[14:11:33.988] Shimmering Obsidian[Script Filter] Queuing argument '(null)'
[14:11:34.746] Shimmering Obsidian[Keyword] Processing complete
[14:11:34.762] Shimmering Obsidian[Keyword] Passing output '' to Post Notification
[14:11:34.763] Shimmering Obsidian[Post Notification] Processing complete
[14:11:34.764] Shimmering Obsidian[Post Notification] Passing output '' to Run Script
[14:11:34.848] STDERR: Shimmering Obsidian[Run Script] mkdir: /Users/christyray/Library/Mobile Documents/iCloudmdobsidian/Documents/Notes/.trash: File exists
/Users/christyray/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.67A5BC3A-139E-46C4-A1F2-E42D30566510/scripts/obsidian-backup.sh:17: no matches found: ./.trash/*
[14:11:34.867] Shimmering Obsidian[Run Script] Processing complete
[14:11:34.869] Shimmering Obsidian[Run Script] Passing output '/Users/christyray/Scripts/Obsidian-Backup/Obsidian-Backup_2022-02-04_14-11.zip
' to Post Notification
[14:11:34.870] Shimmering Obsidian[Post Notification] Processing complete
[14:11:34.871] Shimmering Obsidian[Post Notification] Passing output '/Users/christyray/Scripts/Obsidian-Backup/Obsidian-Backup_2022-02-04_14-11.zip
' to Play Sound
[14:11:34.942] Shimmering Obsidian[Play Sound] Processing complete
[14:11:34.957] Shimmering Obsidian[Play Sound] Passing output '/Users/christyray/Scripts/Obsidian-Backup/Obsidian-Backup_2022-02-04_14-11.zip
' to Call External Trigger
[14:11:34.958] Shimmering Obsidian[External] Processing complete
[14:11:34.959] Shimmering Obsidian[External] Passing output '/Users/christyray/Scripts/Obsidian-Backup/Obsidian-Backup_2022-02-04_14-11.zip
' to Conditional
[14:11:34.961] Shimmering Obsidian[Conditional] Processing complete
[14:11:34.962] Shimmering Obsidian[Conditional] Passing output '/Users/christyray/Scripts/Obsidian-Backup/Obsidian-Backup_2022-02-04_14-11.zip
' to Run Script

Workflow Configuration

The ends of some of the paths are cut off, but I don't believe they are part of the issue.
image

Version & System Information

-------------------------------
Metadata JSONs: 3/3
-------------------------------
INSTALLED VERSION
macOS: 12.1
Obsidian: 0.13.24
Alfred: 4.6.2
Workflow: 2.20.1
Advanced URI Plugin: 1.17.0
Metadata Extractor: 0.3.1
-------------------------------
LATEST VERSION
Obsidian: 0.13.23
Obsidian (Insider): 0.13.24
Workflow: 2.20.2
Advanced URI Plugin: 1.17.0
Metadata Extractor: 0.3.1
-------------------------------

Make sure you have done the following

@christyray christyray added the bug Something isn't working label Feb 4, 2022
@christyray
Copy link
Contributor Author

And, unrelated, the bug report template asks for oinfo, but I think it meant oversions instead?

@christyray
Copy link
Contributor Author

I submitted a pull request with that one line change! I'm not the most familiar with shell scripting, so my apologies if this isn't the best way to fix the issue 🙂

@chrisgrieser
Copy link
Owner

chrisgrieser commented Feb 4, 2022

oh thank you! since I always have stuff in my trash, that's a bug isn't something I'd have stumbled upon my own 😅 Merged and released.

And no worries, I am also not not too familiar with shell scripting, I didn't even know you can do (( )) for conditions 😅

@chrisgrieser
Copy link
Owner

And, unrelated, the bug report template asks for oinfo, but I think it meant oversions instead?

I changed the keyword for that one, I think it's some sort of bug for Alfred, that changes in keywords do not get updated properly sometimes 🙁
If you uninstall the workflow and do a clean install (instead of installing the newest version while you have the workflow already installed), it gets updated properly. I'll look into whether I can maybe find a workaround for that...

@chrisgrieser
Copy link
Owner

chrisgrieser commented Feb 4, 2022

okay, I tried some workaround in release 2.20.4, which should hopefully update the keyword properly
(also closing this, since the original bug has been resolved, thanks again for fixing it!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants