Menu

#1 process archives with filenames containing backslash(es)

1.0
open
None
2015-08-20
2015-08-02
No

had to modify for Mac OSX 10.6.8

:::patch
##9 For each folder in apps/ inside the tar archive, list it. There should be only folders.
echo "Generating list of contents for each app..."

  • for i in apps/* ; do cat list | grep $i/ > app-list/basename $i.list ; done
  • for i in apps/* ; do cat list | grep $i/ | sed -e 's/\\/\/' > app-list/basename $i.list ; done
    echo "Done"

complete patch in attachment
regards
A.

1 Attachments

Discussion

  • dragomerlin

    dragomerlin - 2015-08-03

    Ok but there's also the issue with colon, semicolon, asterisk, question mark... etc

    I don't see why you need this since android will never generate a backup with backslash in filenames. Furthermore it's not portable.

    If you can provide a real example where this issue could happen I'll be happy to consider it.

     
  • Andreas Stern

    Andreas Stern - 2015-08-03

    sorry, but I really needed that, finding the line
    apps/com.google.android.apps.plus/sp/mm_utils\0.xml
    in com.google.android.apps.plus.list
    for apps/com.google.android.apps.plus/sp/mm_utils\0.xml
    could be OS specific, don't know

    regards
    A.

     
  • dragomerlin

    dragomerlin - 2015-08-03

    The sed commands you provide don't work on cygwin

    sed -e 's/\/\/'
    sed: -e expression #1, char 7: unterminated `s' command

    $ echo '/cygdrive/c/backup/apps/com.google.android.apps.plus/sp/mm_utils\0.xml' | sed -e 's/\\/\/'
    /cygdrive/c/backup/apps/com.google.android.apps.plus/sp/mm_utils\0.xml

    What is the real name of the file, "0.xml" or "mm_utils\0.xml"?

     
  • Andreas Stern

    Andreas Stern - 2015-08-16

    sorry for the delay, beeing on holidays

    • filename is mm_utils\0.xml
    • not to mention the additional efforts using java 7 (1.7.0_25) on OS X 10.6.8
    • solution would perhaps be to branch depending on OS, which would be an enourmous effort
    • had, some years ago, not so fine experience with cygwin and am very happy not depending on it any more
    • would perhaps the "original" 17M com.google.android.apps.plus.ab archive help?

    regards

    A.

     

    Last edit: Andreas Stern 2015-08-16
  • dragomerlin

    dragomerlin - 2015-08-16

    I've tested your sed line in Yosemite and it replaces two or more consecutive backslashes with a single one. If two fail one will do the same. Did you mean to do that or do you mean to remove all backslashes?

     

    Last edit: dragomerlin 2015-08-16
  • Andreas Stern

    Andreas Stern - 2015-08-16

    the substitution ( which was not tested on more than that one case, so not "really" tested ) replaces two backslashes by one and made the script work in my special case. The patch contains four backslashes in the search part of the sed substitute command and two slashes in the replace part in order to be processed correctly - was unable to edit original post, so let me repeat

    ~~~~~
    @@ -116,7 +118,7 @@
    echo "Done"
    ##9 For each folder in apps/ inside the tar archive, list it. There should be only folders.
    echo "Generating list of contents for each app..."

    • for i in apps/* ; do cat list | grep $i/ > app-list/basename $i.list ; done
    • for i in apps/* ; do cat list | grep $i/ | sed -e 's/\\/\/' > app-list/basename $i.list ; done
      echo "Done"
      ~~~~~~
     

    Last edit: Andreas Stern 2015-08-16
  • dragomerlin

    dragomerlin - 2015-08-18

    Did you install star on OS X?

     
  • dragomerlin

    dragomerlin - 2015-08-18

    Ok, I've compiled star from source code and manually installed it on OS X Yosemite 10.10.5 with no major issues. I guess I have to write a Readme about how to compile and install star on cygwin and mac.

    I've tested your patch and it works perfectly. It preserves the double backslash in the resulting ab (tar) files. I was in doubt that it stored only a single backslash in them. I will update things as soon as possible.

     
  • Andreas Stern

    Andreas Stern - 2015-08-18

    Yes, installed star using Homebrew, works on OS X 10.6.8
    short how2:

    1. install Homebrew
    2. install star:
    $ brew install star
    

    recall info:

    ~~~~~
    $ brew info star
    star: stable 1.5.3
    Standard tap archiver
    http://cdrecord.org/private/star.html
    /usr/local/Cellar/star/1.5.3 (81 files, 1,7M) *
    Built from source
    From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/star.rb
    ==> Dependencies
    Build: smake ✔
    ~~~~~~

     

    Last edit: Andreas Stern 2015-08-18
  • dragomerlin

    dragomerlin - 2015-08-20

    Download updated. Thank for bringing this issue to my attention.

     

Log in to post a comment.

MongoDB Logo MongoDB