fuselibs icon indicating copy to clipboard operation
fuselibs copied to clipboard

FileSystem.deleteSync should throw an error if the argument is not a path

Open trusis666 opened this issue 7 years ago • 2 comments

Reported on a forum.

Fusetools 1.6 MacOs Android

Code to reproduce:

<App>
    <JavaScript>
        var FileSystem = require("FuseJS/FileSystem");
        FileSystem.deleteSync(FileSystem.readTextFromFileSync(FileSystem.dataDirectory + "/credentials.json"));
    </JavaScript>
</App>

Problem

Not throwing error message in Android emulator, if argument is not a path.

Behaviour on Android (expected):

02-01 11:39:04.663 17077 17095 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7 in tid 17095 (Thread-23311)
02-01 11:39:04.768   394   394 F DEBUG   : pid: 17077, tid: 17095, name: Thread-23311  >>> com.apps.XXXXX <<<
02-01 11:39:05.284   906  3378 W InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 17077 uid 10376
02-01 11:39:05.301   342   342 E lowmemorykiller: Error writing /proc/17077/oom_score_adj; errno=22
02-01 11:39:05.304   428   428 I Zygote  : Process 17077 exited due to signal (11)
02-01 11:39:05.336   906  3310 I ActivityManager: Process com.apps.XXXXX (pid 17077) has died
Process com.apps.XXXXX terminated.
Unknown Logcat Error: raised from 'adb -s BH90C3UK1E logcat 

trusis666 avatar Feb 01 '18 11:02 trusis666

Does the log indicate the program crashes when calling deleteSync or only to show there is no message/exception?

It's not certain if an exception should be thrown, possibly this returns a success value instead (the docs are light). If that was the intent then we can't change this without breaking backwards compatibility.

If the defect is that the whole app crashes, then yeah, that should be fixed.

mortoray avatar Feb 01 '18 11:02 mortoray

The forum thread FileSystem.deleteSync posted by [email protected] was linked to this issue.

fusebuild avatar Feb 01 '18 15:02 fusebuild