Repository: leil-io/saunafs (language: cpp)

Issue:
recursive_remove.cc: fail to build
I'm trying to build for arm64 (in docker, ubuntu jammy), but getting the following error:

> /tmp/saunafs_deb_working_directory.2024-05-07_143835.1Z3oVs/saunafs/src/tools/recursive_remove.cc: In function 'int recursive_remove_run(int, char**)':
> /tmp/saunafs_deb_working_directory.2024-05-07_143835.1Z3oVs/saunafs/src/tools/recursive_remove.cc:129:47: error: comparison is always true due to limited range of data type [-Werror=type-limits]
>   129 |         while ((ch = getopt(argc, argv, "l")) != -1) {
>       |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> cc1plus: all warnings being treated as errors

It seems that the issue is not related to the architecture, but rather that `ch` is unsigned.


Discussion / hints:
I found the cause. On arm64, an implicit char is unsigned (whereas on x86 it is signed).

Since I'm assuming the arm architecture is out of your scope, I will close this.
> I found the cause. On arm64, an implicit char is unsigned (whereas on x86 it is signed).
> Since I'm assuming the arm architecture is out of your scope, I will close this.

While it's true that ARM64 is a low priority for us, that doesn't mean we don't want to improve it.

We checked yesterday and found the same exact issue (char is unsigned on arm, versus signed on x86). Everywhere else it uses int but in this specific instance it's using char for some reason. It compiles everything when it's changed to int.

We know ARM64 has definite problems, especially regarding performance. So we would be happy if people who use ARM can continue reporting issues like these, especially because we are focused on x86.

I would even accept PR's for improvement regarding ARM64, otherwise I think we can fix this particular issue in a few days in the `dev` branch.
Thanks, I'm happy to hear that!

Fix patch:
diff --git a/src/tools/recursive_remove.cc b/src/tools/recursive_remove.cc
index 161cd82c3..8d09a7f37 100644
--- a/src/tools/recursive_remove.cc
+++ b/src/tools/recursive_remove.cc
@@ -122,7 +122,7 @@ static int recursive_remove(const char *file_name, int long_wait) {
 }
 
 int recursive_remove_run(int argc, char **argv) {
-	char ch;
+	int ch;
 	int status;
 	int long_wait = 0;
 


Test patch: