Open xlibun opened 2 years ago
I have the identical issue on Kali Linux.
there are mix of space and tab indentation in that part of the code, just change it all to 4 spaces
same issue
"there are mix of space and tab indentation in that part of the code, just change it all to 4 spaces"
This is not true, and does nothing to actually fix the problem. The 'if' clause referenced on line 1835 is missing the { and } that includes the ERROR statement that comes afterward. Just adding them, however, doesn't fix the problem, as "unsquashfs.c" looks like it was indented by a psychopath, with random breaks in weird places that don't belong all over the place.
example on where the next error occurs if you fix the if statement (unsquashfs.c:1128:49: error: implicit declaration of function 'makedev' [-Werror=implicit-function-declaration]):
if(mknod(pathname, chrdev ? S_IFCHR : S_IFBLK,
makedev((i->data >> 8) & 0xff,
i->data & 0xff)) == -1) {
ERROR("create_inode: failed to create "
"%s device %s, because %s\n",
chrdev ? "character" : "block",
pathname, strerror(errno));
break;
}
Here's what that SHOULD look like (apologies for the wordwrap):
if(mknod(pathname, chrdev ? S_IFCHR : S_IFBLK, makedev((i->data >> 8) & 0xff, i->data & 0xff)) == -1)
{
ERROR("create_inode: failed to create %s device %s, because %s\n", chrdev ? "character" : "block", pathname, strerror(errno));
break;
}
Now, I don't deal with a lot of C code with what I do, mostly python, so someone tell me if I'm completely off base here. But onesy-twosy fixes aren't going to work here.
I also tried importing the lastest ver of squashfs (4.4) - no dice.
The latest pull request fixes these issues: https://github.com/devttys0/sasquatch/pull/47
The latest pull request fixes these issues: #47
this patch can solve this issue, but the build.sh scripts wrote a wrong path which cause the patch not work.
$ diff bd.sh build.sh
35c35
< patch -p0 < patches/patch0.txt
---
> patch -p0 < ../patches/patch0.txt
patching file squashfs-tools/unsquashfs.c
Hunk #1 succeeded at 32 with fuzz 1.
cc -g -O2 -I. -I./LZMA/lzma465/C -I./LZMA/lzmalt -I./LZMA/lzmadaptive/C/7zip/Compress/LZMA_Lib -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOMP_DEFAULT=\"gzip\" -Wall -Werror -DGZIP_SUPPORT -DLZMA_SUPPORT -DXZ_SUPPORT -DLZO_SUPPORT -DXATTR_SUPPORT -DXATTR_DEFAULT -c -o unsquashfs.o unsquashfs.c
unsquashfs.c: In function ‘read_super’:
unsquashfs.c:1835:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
1835 | if(swap)
| ^~
unsquashfs.c:1841:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
1841 | read_fs_bytes(fd, SQUASHFS_START, sizeof(struct squashfs_super_block),
| ^~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: unsquashfs.o] Error 1
build
So, how to fix? I am dealing with this error since days, tried all solutions on internet and none of them worked.
build
So, how to fix? I am dealing with this error since days, tried all solutions on internet and none of them worked.
it's caused by inconsistent indentation (tab/space mixed), find it around that line caused error and make it consistent
compiling from commit 82da12
of master
from this forked repo solved the issue with me on Kali Release version 2022.3.
I have the same error on Ubuntu 22.04.1
Can you give me any hint what to do?
Solve:
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch
cd sasquatch
wget https://github.com/devttys0/sasquatch/pull/47.patch && patch -p1 < 47.patch && sudo ./build.sh
Despite fixing this error, there is an issue when extracting lzma compressed data from a firmware binary. Where most of the files are empty.
Solve:
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch cd sasquatch wget https://github.com/devttys0/sasquatch/pull/47.patch && patch -p1 < 47.patch && sudo ./build.sh
Doing this, as noted also by @iAmG-r00t, causes some files to be lost while extracting some squashfs images (e.g., see https://github.com/ReFirmLabs/binwalk/issues/618), don't know why.
On Ubuntu 22.04.1LTS I suggest to compile using https://github.com/devttys0/sasquatch/pull/51 instead:
cd /tmp
git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch
cd sasquatch
wget https://github.com/devttys0/sasquatch/pull/51.patch && patch -p1 <51.patch
sudo ./build.sh
compiling from commit
82da12
ofmaster
from this forked repo solved the issue with me on Kali Release version 2022.3.
Excellent! Only your method can solve this issue correctly.
I have tried all solutions here and i still have issues compiling unsquashfs , the original git here even after the patch been revised still gives compiling issues and breaks , all others i get a lot of warnings but compile , however i believe this is not a perfect compilation and somethings may break or not work when using this tool , i used pastebin to post all the compilation , and i came here because i was trying to compile binwalk from source and i got stuck in this tool , so i decided to compile this tool manually . https://pastebin.com/p8Cnyxhx
On Ubuntu 22.04.1LTS I suggest to compile using #51 instead:
cd /tmp git clone --quiet --depth 1 --branch "master" https://github.com/devttys0/sasquatch cd sasquatch wget https://github.com/devttys0/sasquatch/pull/51.patch && patch -p1 <51.patch sudo ./build.sh
Thanks for your solution! It worked for me on WSL2 (Ubuntu 22.04).
Error:
code from 1835 to 1845: