Menu

#173 RMT - extend 's' command should consume '\n'?

None
closed-works-for-me
nobody
None
5
2021-10-01
2021-09-29
No

Symptoms:
/etc/rmt exits after the final A correctly(?) returning
the mt_flags (A327680) member.
(The tape device is open(2)ed nonblocking to retrieve the
status as it doesn't have a tape loaded.)


I-1
0
A1
O/dev/st0
O_RDWR|O_NONBLOCK
A0
sf
A327680

dump-0.4b47/rmt/rmt.c

489 case 's':
490 { char s;
...
495 if (read (0, &s, 1) != 1)
496 goto top;

Line 495 only consumes the 's' subcommand leaving the trailing '\n'
for the read on line 140 which exits fthout the switch default (line 544)

145 if (read(0, &c, 1) != 1)
146 exit(0);
147 switch (c) {

Simple fix is to read the subcommand with getstring

- if (read (0, &s, 1) != 1)
+ getstring (op);
+ s = op [0];
+ if (s == '\n')
goto top;

Discussion

  • Bebu sa Ware

    Bebu sa Ware - 2021-10-01

    Please close.
    Should have read the fine manual :)
    Both the 'S' and 's' commands aren't terminated by '\n'
    So one way to test is with the V1 version 'v' command after the 's' cmd
    eg retrieve mt_blkno

    sBv
    A1
    A1

     
  • Mike Frysinger

    Mike Frysinger - 2021-10-01
    • status: open --> closed-works-for-me
    • Group: -->
     
  • Mike Frysinger

    Mike Frysinger - 2021-10-01

    glad you were able to figure it out

     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.
Try Free →