Code Monkey home page Code Monkey logo

Comments (13)

lra avatar lra commented on July 16, 2024

Can you give me the output of ls -al /Users/dbingham/Library/Application Support/SourceTree/ and ls -al "Dropbox/Mackup/Library/Application Support/SourceTree/" ?

from mackup.

dbingham avatar dbingham commented on July 16, 2024
$ ls -al /Users/dbingham/Library/Application\ Support/SourceTree/
total 48
drwxr-xr-x    9 dbingham  staff   306 Apr  2 12:35 ./
drwx------+ 106 dbingham  staff  3604 Apr 29 09:17 ../
drwxr-xr-x    3 dbingham  staff   102 Nov  9  2011 MASReceipt/
drwxr-xr-x    8 dbingham  staff   272 Apr  2 11:17 SourceTree 1.5.8/
-rw-r--r--    1 dbingham  staff  5361 Apr  2 12:35 browser.plist
-rw-r--r--@   1 dbingham  staff   812 Apr  2 11:59 hgrc_sourcetree
-rw-r--r--    1 dbingham  staff   366 Mar 18 09:45 hostusernamemap
-rw-r--r--    1 dbingham  staff   236 Apr  2 12:35 openWindowList
-rw-r--r--@   1 dbingham  staff   568 Feb 27  2012 sourcetree.license

and

$ ls -al "Dropbox/Mackup/Library/Application Support/SourceTree/"
total 8
drwxr-xr-x  3 dbingham  staff  102 Apr 29 09:17 ./
drwxr-xr-x  6 dbingham  staff  204 Apr 29 09:17 ../
-rw-------  1 dbingham  staff  568 Apr 29 09:17 sourcetree.license

from mackup.

lra avatar lra commented on July 16, 2024

Can you try this version ? https://github.com/lra/mackup/blob/fix_sourcetree/mackup.py
Replace your current mackuped sourcetree files if asked.

If it breaks anything, just move back your "Application Support/SourceTree" from Mackup to your user's library.

from mackup.

dbingham avatar dbingham commented on July 16, 2024
dbingham-itko:mackup(fix_sourcetree) dbingham$ ./mackup.py backup
Backing up Library/Application Support/SourceTree/sourcetree.license...
A file named /Users/dbingham/Dropbox/Mackup/Library/Application Support/SourceTree/sourcetree.license already exists in the backup.
Are you sure that your want to replace it ? <Yes|No>Yes
Traceback (most recent call last):
  File "./mackup.py", line 734, in <module>
    main()
  File "./mackup.py", line 687, in main
    app.backup()
  File "./mackup.py", line 304, in backup
    delete(filepath)
  File "./mackup.py", line 493, in delete
    os.remove(filepath)
OSError: [Errno 1] Operation not permitted: '/Users/dbingham/Library/Application Support/SourceTree/sourcetree.license'

from mackup.

dbingham avatar dbingham commented on July 16, 2024

So. I looked at this a bit more...

-------------------------------------------------------------------------------------------------------- 09:14:22
dbingham-itko:mackup(fix_sourcetree) dbingham$ ls -l /Users/dbingham/Library/Application\ Support/SourceTree/sourcetree.license
-rw-r--r--@ 1 dbingham  staff  568 Feb 27  2012 /Users/dbingham/Library/Application Support/SourceTree/sourcetree.license
-------------------------------------------------------------------------------------------------------- 09:14:27
dbingham-itko:mackup(fix_sourcetree) dbingham$ xattr "/Users/dbingham/Library/Application Support/SourceTree/sourcetree.license"
com.apple.metadata:com_apple_backup_excludeItem
com.apple.quarantine

Nothing really odd there. I'd expect to be able to delete the file. Let's clone the dir and try to delete the file from the OS and see what happens.

-------------------------------------------------------------------------------------------------------- 09:15:30
dbingham-itko:mackup(fix_sourcetree) dbingham$ ditto "/Users/dbingham/Library/Application Support/SourceTree" ~/Desktop/SourceTree
-------------------------------------------------------------------------------------------------------- 09:19:49
dbingham-itko:mackup(fix_sourcetree) dbingham$ ls -la ~/Desktop/SourceTree/
total 48
drwxr-xr-x  9 dbingham  staff   306 Apr  2 12:35 ./
drwx------+ 5 dbingham  staff   170 Apr 30 09:19 ../
drwxr-xr-x  3 dbingham  staff   102 Nov  9  2011 MASReceipt/
drwxr-xr-x  8 dbingham  staff   272 Apr  2 11:17 SourceTree 1.5.8/
-rw-r--r--  1 dbingham  staff  5361 Apr  2 12:35 browser.plist
-rw-r--r--@ 1 dbingham  staff   812 Apr  2 11:59 hgrc_sourcetree
-rw-r--r--  1 dbingham  staff   366 Mar 18 09:45 hostusernamemap
-rw-r--r--  1 dbingham  staff   236 Apr  2 12:35 openWindowList
-rw-r--r--@ 1 dbingham  staff   568 Feb 27  2012 sourcetree.license
-------------------------------------------------------------------------------------------------------- 09:19:58
dbingham-itko:mackup(fix_sourcetree) dbingham$ xattr ~/Desktop/SourceTree/sourcetree.license 
com.apple.metadata:com_apple_backup_excludeItem
com.apple.quarantine
-------------------------------------------------------------------------------------------------------- 09:20:11
dbingham-itko:mackup(fix_sourcetree) dbingham$ rm ~/Desktop/SourceTree/sourcetree.license 
override rw-r--r--  dbingham/staff uchg for /Users/dbingham/Desktop/SourceTree/sourcetree.license? y
rm: /Users/dbingham/Desktop/SourceTree/sourcetree.license: Operation not permitted

Hm. Ok. 'dbingham' has write, so should be able to delete. Am I who I think I am?

-------------------------------------------------------------------------------------------------------- 09:20:42
dbingham-itko:mackup(fix_sourcetree) dbingham$ whoami
dbingham
-------------------------------------------------------------------------------------------------------- 09:20:45
dbingham-itko:mackup(fix_sourcetree) dbingham$ groups
staff com.apple.access_ssh access_bpf everyone _appstore localaccounts _appserverusr admin _appserveradm _lpadmin _lpoperator _developer com.apple.sharepoint.group.1 com.apple.access_screensharing-disabled com.apple.sharepoint.group.2

Yes, I am. Weird. How about dir permissions. If the dir doesn't have write, I won't be able to delete...

-------------------------------------------------------------------------------------------------------- 09:21:40
dbingham-itko:mackup(fix_sourcetree) dbingham$ ls -ld "/Users/dbingham/Library/Application Support/SourceTree"
drwxr-xr-x  9 dbingham  staff  306 Apr  2 12:35 /Users/dbingham/Library/Application Support/SourceTree/

But it does, so that's not it. Only other thing I know of is file flags.

-------------------------------------------------------------------------------------------------------- 09:22:02
dbingham-itko:mackup(fix_sourcetree) dbingham$ ls -lO "/Users/dbingham/Library/Application Support/SourceTree"
total 48
drwxr-xr-x  3 dbingham  staff  -     102 Nov  9  2011 MASReceipt/
drwxr-xr-x  8 dbingham  staff  -     272 Apr  2 11:17 SourceTree 1.5.8/
-rw-r--r--  1 dbingham  staff  -    5361 Apr  2 12:35 browser.plist
-rw-r--r--@ 1 dbingham  staff  -     812 Apr  2 11:59 hgrc_sourcetree
-rw-r--r--  1 dbingham  staff  -     366 Mar 18 09:45 hostusernamemap
-rw-r--r--  1 dbingham  staff  -     236 Apr  2 12:35 openWindowList
-rw-r--r--@ 1 dbingham  staff  uchg  568 Feb 27  2012 sourcetree.license

And there it is. "uchg". Weird. I never set that myself. Maybe an earlier version of sourcetree did it automatically? Let's remove it and be sure...

-------------------------------------------------------------------------------------------------------- 09:40:55
dbingham-itko:mackup(fix_sourcetree) dbingham$ chflags nouchg ~/Desktop/SourceTree/sourcetree.license 
-------------------------------------------------------------------------------------------------------- 09:41:04
dbingham-itko:mackup(fix_sourcetree) dbingham$ rm ~/Desktop/SourceTree/sourcetree.license 

Well, that worked. Let's try it on the real file and try mackup again.

-------------------------------------------------------------------------------------------------------- 09:41:40
dbingham-itko:mackup(fix_sourcetree) dbingham$ chflags nouchg ~/Library/Application\ Support/SourceTree/sourcetree.license 
-------------------------------------------------------------------------------------------------------- 09:42:03
dbingham-itko:mackup(fix_sourcetree) dbingham$ ./mackup.py backup
Backing up Library/Application Support/SourceTree/sourcetree.license...
A file named /Users/dbingham/Dropbox/Mackup/Library/Application Support/SourceTree/sourcetree.license already exists in the backup.
Are you sure that your want to replace it ? <Yes|No>Yes
Backing up Library/Application Support/SourceTree/browser.plist...
Backing up Library/Application Support/SourceTree/hgrc_sourcetree...
...

Works like a charm now.

from mackup.

lra avatar lra commented on July 16, 2024

Thanks that helps I'll work on this

from mackup.

lra avatar lra commented on July 16, 2024

Could you try the latest version of https://github.com/lra/mackup/blob/fix_sourcetree/mackup.py ?
It should fix all those problems for good.

from mackup.

lra avatar lra commented on July 16, 2024

you can bring back the sourcetree folder and chflags -R uchg it before.

from mackup.

dbingham avatar dbingham commented on July 16, 2024

Yeah, it works. But it messes with permissions in a way I wouldn't expect. I would expect permissions to be preserved as much as possible. For example:

Before (I put things back as close as possible to the original state):

dbingham-itko:SourceTree dbingham$ ls -lO@
total 48
drw-r--r--  3 dbingham  staff  -     102 Nov  9  2011 MASReceipt/
drw-r--r--  8 dbingham  staff  -     272 Apr  2 11:17 SourceTree 1.5.8/
-rw-r--r--  1 dbingham  staff  -    5361 Apr 30 11:37 browser.plist
-rw-r--r--@ 1 dbingham  staff  -     812 Apr 30 11:37 hgrc_sourcetree
    com.apple.TextEncoding    15 
-rw-r--r--  1 dbingham  staff  -     366 Mar 18 09:45 hostusernamemap
-rw-r--r--  1 dbingham  staff  -     236 Apr  2 12:35 openWindowList
-rw-r--r--@ 1 dbingham  staff  uchg  568 Apr 30 11:37 sourcetree.license
    com.apple.metadata:com_apple_backup_excludeItem   17 

And the files in the Mackup directory on Dropbox after a backup:

dbingham-itko:SourceTree dbingham$ ls -lO@
total 32
-rw-------  1 dbingham  staff  - 5361 Apr 30 11:49 browser.plist
-rw-------  1 dbingham  staff  -  812 Apr 30 11:49 hgrc_sourcetree
-rw-------  1 dbingham  staff  -  568 Apr 30 11:49 sourcetree.license

So, I expected the uchg flag to be gone, but didn't expect the xattrs to be gone and the permissions to change from 644 to 600.

Is that a limitation of Dropbox?

from mackup.

dbingham avatar dbingham commented on July 16, 2024

Also, while I'm thinking about it, is hostusernamemap not something we'd want to keep around? The name sounds like something that would be fairly useful.

from mackup.

lra avatar lra commented on July 16, 2024

For the chmod and xattrs being cleaned up, it's because dropbox uses a default umask of 0644 for files, and when you sync your ssh keys (or any other license) you don't (and can't for ssh) have your key files readable by anyone.

As I don't think it make sense for any user config file to be readable by anyone, I just blindly enforce a mode of 0600 to any synced file.

The xattrs are cleaned up, because OS X use them to set some ACL that prevent mackup to move some files around too, and I don't see the point of keeping those special ACLs if I 0600 any file. But I might be wrong here.

About hostusernamemap, if you think it's a file that should be synced, we can add it to the list, feel free to tell me which file to sync here as I'm not a user of SourceTree.

from mackup.

dbingham avatar dbingham commented on July 16, 2024

On the permissions changes, I doubt it'll matter for the vast majority of stuff. Maybe someday you'll run across an application that just has to have its xattrs 'just so' in order to work. But until then, I say, go with what you've got. It makes things "cleaner" anyway.

I use SourceTree, but I don't know much about how it manages its files. The filename just sounded like it would be something along the lines of a cache of usernames you've used when authenticating with various hostnames. I could be totally wrong. But, in any case, it doesn't sound like anything critical. I could even see an argument for excluding it on purpose for security reasons. Feels weak to me, but I could see it.

Anyway, pure speculation on my part. If/when I come across anything definite about this file I'll either open a new ticket or send a pull request your way.

For the issue I reported here, I think we're good now. Feel free to close away!

Thanks!

from mackup.

lra avatar lra commented on July 16, 2024

Makes sense, merging in, thx for your help

from mackup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.