Bug report on fix_permissions.sh

Search This thread

FlorentBL

Member
Apr 26, 2011
8
1
Hi all,

According to this thread (http://xdaforums.com/showthread.php?t=522935&page=14) the fix_permissions.sh file can be found here:

ezterry said:
I usually just grab it from CyanogenMod's git hub when I need a stand alone copy (or to copy it into my ezGingerbread repo)

https://github.com/CyanogenMod/andro...ix_permissions

This post just to report that a line such as
Code:
FP_NUMS=$( $CAT /data/system/packages.xml | $EGREP "^<package.*serId" | $GREP -v framework-res.apk | $GREP -v com.htc.resources.apk | $WC -l )
is now false. Some ROMs get their packages.xml in /dbdata/system.

Something like this should be put in the code:
Code:
for dir in /dbdata/system /data/system; do
  [[ -d "${dir}" ]] && break
done
PACKAGES="${dir}/packages.xml"

Sorry for reporting here, but it seems that newbies cannot post in developers forums nor make a decent signature to inform on who they are :eek:
 

teknowledgist

Member
Jan 4, 2011
13
4
Albany
fix_permissions script fix for some ROMs

This saved my day/week/month!! Thanks man! :D

I got tired of having to re-configure all my apps after a re-flash (TBU backs up, but refuses to restore anything for me!!), so i've been wrestling with a bunch of settings recovered from a TBU archive. Dropping them into the proper locations caused all the relevant apps to FC. (I guess that's because the apps don't have rights to their settings.)

The only possible solution I've been able to find is to use fix_permissions, but the latest version (2.04) kept giving me an error and I'm too much of a noob to guess another location for packages.xml.

I changed your code a bit because the mod I'm using (Serendipity) has both a /dbdata/system and a /data/system directory, so it would have always used the first directory in the list. The change worked great though.

For other semi-capable hackers who might need this (and since I'm not in a position to post it back to github), I took the v2.04 of fix_permissions (here: github.com/CyanogenMod/android_vendor_cyanogen/raw/gingerbread/prebuilt/common/bin/fix_permissions) and added
Code:
for packdir in /dbdata/system /data/system; do
  [[ -f "${packdir}/packages.xml" ]] && break
done
PACKAGES="${packdir}/packages.xml"

in the Initialise vars section, and then changed the 4 instances of data/system/packages.xml to $PACKAGES

The updated version is attached below. Hope this helps someone too.
 

Attachments

  • fix_permissions2.05.txt
    14.6 KB · Views: 427

FlorentBL

Member
Apr 26, 2011
8
1
Glad to see that the post helps at least one person :D

Rereading it, I feel ashame by my mistake trying to mend the script :eek:

Anyway, your fix works of course.

By the way, the cause of all this seems bug traced in android code as bug 9976 (sorry I still cannot post the link, you'll have to find it by yourself in code.google.com)
 

Reapy2

New member
Feb 26, 2013
1
0
I know I'm digging up an old thread, but I am having trouble locking down where fix_permissions.sh 2.04 came from. The link above doesn't work etc. I've pulled it from twrp recovery (though according to their page/source its rewritten in c++), not really sure how to compile just that as I only need the script.

Anyway, just as an FYI for anyone pulling the script from here, ther script there is a slight bug on line 251 that probably won't affect most people as long as cut works from the command line, but

Code:
   FP_OLDPER=$( $ECHO $FP_OLDPER | cut -c2-10 )

should be

Code:
   FP_OLDPER=$( $ECHO $FP_OLDPER | $CUT -c2-10 )

Only noticed this since I had to push over my own busybox and changed the commands to be ./busybox to use the busybox pushed with the script to the phone and noticed the cut command was failing.