Re: streams & truename

Sam Steingold <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
Bruno,

We have a problem, yet another case where the CL universe is different
from UNIX (and, probably, Windows, but I don't have access to that, so,
thankfully, I can excuse myself):

* CL assumes that (truename open-file-stream) works

* on unix, "/dev/fd/0" resolves to "/proc/<pid>/fd/0" which is a symlink
  to "pipe:[123456789]" when the process is run like "clisp | cat".
  (and the "/proc/<pid>/fd/pipe:[...]" file does not exist).
  IOW, on unix one can do i/o on a non-existent path (sometimes).

What to do about it?

* We can detect that "/proc/<pid>/fd/0" is on "/proc" and refuse to
  follow symlinks there.
  This is fairly arbitrary, but we already use this sort of magic when
  deciding the default value for the :buffered argument.
  This would also prevent users from detecting that the stdout is a
  path (not good).
  [btw, shouldn't we treat /proc and /dev identically? neither is a real
  file system].

* We can defer computing strm_file_truename until necessary, leading to
  various special cases for (open (make-stream :input)) (which will call
  truename) &c.

I don't particularly like either approach; but I think I dislike the
first one less.

Other ideas?

> * Bruno Haible <[email protected]> [2017-02-27 22:25:59 +0100]:
>
> $ ./clisp -K boot  -E UTF-8 -Emisc 1:1 -Epathname 1:1 -norc --version 2>/dev/null | \
>   hexdump -e '"%06.6_ax  " 16/1 "%02X "' -e '"  " 16/1 "%_p" "\n"' "$@"
> 000000  0A 2A 2A 2A 20 2D 20 54 52 55 45 4E 41 4D 45 3A  .*** - TRUENAME:
> 000010  20 54 68 65 20 76 61 6C 75 65 20 6F 66 20 2A 54   The value of *T
> 000020  45 52 4D 49 4E 41 4C 2D 49 4F 2A 20 77 61 73 20  ERMINAL-IO* was 
> 000030  6E 6F 74 20 61 6E 20 61 70 70 72 6F 70 72 69 61  not an appropria
> 000040  74 65 20 73 74 72 65 61 6D 3A 20 23 3C 43 4C 4F  te stream: #<CLO
> 000050  53 45 44 20 49 4F 20 54 45 52 4D 49 4E 41 4C 2D  SED IO TERMINAL-
> 000060  53 54 52 45 41 4D 3E 2E 20 49 74 20 68 61 73 20  STREAM>. It has 
> 000070  62 65 65 6E 20 63 68 61 6E 67 65 64 20 74 6F 0A  been changed to.
> 000080  20 20 20 20 20 20 23 3C 49 4F 20 54 45 52 4D 49        #<IO TERMI
> 000090  4E 41 4C 2D 53 54 52 45 41 4D 3E 2E 0A 45 78 69  NAL-STREAM>..Exi
> 0000a0  74 69 6E 67 20 6F 6E 20 73 69 67 6E 61 6C 20 36  ting on signal 6
> 0000b0  0A                                               .
>
> Sam, your turn, I guess.

-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net http://www.dhimmitude.org
http://iris.org.il http://no2bds.org http://camera.org https://ffii.org
Life is like Tetris: failures accumulate, successes fade.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.