LogtalkDotOrg / logtalk3

Logtalk - declarative object-oriented logic programming language
https://logtalk.org
Apache License 2.0
425 stars 31 forks source link

os::full_device_path/1 is incorrect #178

Closed infradig closed 1 year ago

infradig commented 1 year ago

Whether by design or otherwise os::full_device_path/1 is currently returning /dev/null when it should be /dev/full.

pmoura commented 1 year ago

Thanks for noticing. Tired eyes and too much multitasking. Fixed now. Unfortunately, it seems that most Prolog systems fail to correctly handle errors from devices.

infradig commented 1 year ago

SWI and Trealla (at least) only fail on the close. The writes don't generate a testable error at least on Linux.

On Tue, Aug 1, 2023 at 5:10 PM Paulo Moura @.***> wrote:

Thanks for noticing. Tired eyes and too much multitasking. Fixed now. Unfortunately, it seems that most Prolog systems fail to correctly handle errors from devices.

— Reply to this email directly, view it on GitHub https://github.com/LogtalkDotOrg/logtalk3/issues/178#issuecomment-1659702179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSERIFFOMLVTVI2KGLO3XTCTWFANCNFSM6AAAAAA27GCTPI . You are receiving this because you authored the thread.Message ID: @.***>

infradig commented 1 year ago

Itl seems adding a fflush() call to nl/1 was enough to trigger it. Makes sense.

On Tue, Aug 1, 2023 at 5:10 PM Paulo Moura @.***> wrote:

Thanks for noticing. Tired eyes and too much multitasking. Fixed now. Unfortunately, it seems that most Prolog systems fail to correctly handle errors from devices.

— Reply to this email directly, view it on GitHub https://github.com/LogtalkDotOrg/logtalk3/issues/178#issuecomment-1659702179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSERIFFOMLVTVI2KGLO3XTCTWFANCNFSM6AAAAAA27GCTPI . You are receiving this because you authored the thread.Message ID: @.***>

pmoura commented 1 year ago

SWI and Trealla (at least) only fail on the close. The writes don't generate a testable error at least on Linux.

Yes, that's one of the main issues. Makes sense to only get an error when the output is flushed. With the latest Trealla Prolog version:

$ tplgt
...
Trealla Prolog (c) Infradig 2020-2023, v2.23.38
?- catch((open('/dev/full', write, S), write(S, foo), close(S)), E, true).
   E = error(io_error('No space left on device','<$stream>'(4)),close/1).

A lack of space error is indeed the expected error. Unfortunately, the ISO standard fails to specify the exact exception that should be throw in this case.