Question [Q] Set_Perm failed on SU Binary.

I've been having a little problem for which I couldn't fix with 2 hours of work on Atomic GB 7.1 B2 recently.
I keep getting Status 7 error (Set_perm failed, no such file or directory) on the SU binaries when they are clearly there.

I've tried the following.

- Rewriting the entire updater-script
- Changing my SU binary in system/bin
- Adding my binary to /xbin instead and symlinking the other way
- Having both copies of the binary (without symlinking of course) in /bin and /xbin, both give this error.
- Using different SU apps and binaries.
- Even using existing updater-scripts and simple ones.

Script: (Where it gives Status 7)
Code:
Select Code
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/bin/su");
symlink("/system/bin/su", "/system/xbin/su");

Log:
Code:
Select Code
minzip: Extracted file "/system/xbin/busybox"
minzip: Extracted file "/system/xbin/daemonsu"
minzip: Extracted file "/system/xbin/dexdump"
minzip: Extracted file "/system/xbin/entro"
minzip: Extracted file "/system/xbin/openvpn"
minzip: Extracted file "/system/xbin/rngd"
minzip: Extracted file "/system/xbin/sqlite3"
minzip: Extracted file "/system/xbin/su"
minzip: Extracted file "/system/xbin/zipalign"
about to run program [/tmp/installbusybox] with 1 args
set_perm: chown of /system/xbin/su to 0 0 failed: No such file or directory
set_perm: chmod of /system/xbin/su to 6755 failed: No such file or directory
script aborted: set_perm: some changes failed
set_perm: some changes failed
E:Error in /sdcard/Extracted/ATGB r3.zip
Edit : I might just aswell release without SU and provide it as another zip for now.
Edit 2 : I fixed it. Turns out the problem was caused somehow by my update-binary.

Request thread lock.