Update of bug #61534 (project screen): Assigned to: None => anaumov Planned Release: None => 4.9.0
_______________________________________________________ Follow-up Comment #1: Try this: diff --git a/src/screen.c b/src/screen.c index 1a22892..85959b1 100644 --- a/src/screen.c +++ b/src/screen.c @@ -778,6 +778,10 @@ int main(int ac, char** av) if (--ac == 0) exit_with_usage(myname, "Specify session-name with -S", NULL); SockMatch = *++av; + debug1("SockMatch: '%s'\n", SockMatch); + debug1("SockMatch len: '%d'\n", (int)strlen(SockMatch)); + if (strlen(SockMatch) > 80) + exit_with_usage(myname, "Session-name is too long (max length is 80 symbols)", NULL); } if (!*SockMatch) exit_with_usage(myname, "Empty session-name?", NULL); @@ -1203,6 +1207,13 @@ int main(int ac, char** av) SetTtyname(false, &st); if (!*av) Panic(0, "Please specify a command."); + if (!strcmp("sessionname", *av)) { + if (!*++av) + Panic(0, "Please specify a parameter."); + if (strlen(*av) > 80) + Panic(0, "Parameter of command 'sessionname' is too long."); + } + *--av; SET_GUID(); SendCmdMessage(sty, SockMatch, av, queryflag >= 0); exit(0); That's what I get: $ ./screen -ls No Sockets found in /tmp/uscreens/S-alex. $ ./screen -S averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -d -m bash -c 'ping -c 600 localhost' Use: ./screen [-opts] [cmd [args]] or: ./screen -r [host.tty] Options: -a Force all capabilities into each window's termcap. -A -[r|R] Adapt all windows to the new display width & height. -c file Read configuration file instead of '.screenrc'. -d (-r) Detach the elsewhere running screen (and reattach here). -dmS name Start as daemon: Screen session in detached mode. -D (-r) Detach and logout remote (and reattach here). -D -RR Do whatever is needed to get a screen session. -e xy Change command characters. -f Flow control on, -fn = off, -fa = auto. -h lines Set the size of the scrollback history buffer. -i Interrupt output sooner when flow control is on. -l Login mode on (update /var/run/utmp), -ln = off. -ls [match] or -list Do nothing, just list our SockDir [on possible matches]. -L Turn on output logging. -Logfile file Set logfile name. -m ignore $STY variable, do create a new screen session. -O Choose optimal output rather than exact vt100 emulation. -p window Preselect the named window if it exists. -q Quiet startup. Exits with non-zero return code if unsuccessful. -Q Commands will send the response to the stdout of the querying process. -r [session] Reattach to a detached screen process. -R Reattach if possible, otherwise start a new session. -s shell Shell to execute rather than $SHELL. -S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>. -t title Set title. (window's name). -T term Use term as $TERM for windows, rather than "screen". -U Tell screen to use UTF-8 encoding. -v Print "Screen version 4.09.00 (GNU) 07-Jan-22". -wipe [match] Do nothing, just clean up SockDir [on possible matches]. -x Attach to a not detached screen. (Multi display mode). -X Execute <cmd> as a screen command in the specified session. Error: Session-name is too long (max length is 80 symbols) $ echo $? 1 > ./screen -ls No Sockets found in /tmp/uscreens/S-alex. > ./screen -S averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -d -m bash -c 'ping -c 600 localhost' $ ./screen -ls There is a screen on: 19381.averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (Detached) 1 Socket in /tmp/uscreens/S-alex. $ ./screen -r averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ... I see the ping cmd... press Ctrl-C... [screen is terminating] $ echo $? 0 and the second case: $ ./screen -ls No Sockets found in /tmp/uscreens/S-alex. $ ./screen -S shortname -d -m bash -c 'ping -c 600 localhost' $ ./screen -ls There is a screen on: 19318.shortname(Detached) 1 Socket in /tmp/uscreens/S-alex. $ ./screen -S shortname -X sessionname averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Parameter of command 'sessionname' is too long. $ echo $? 1 $ ./screen -S shortname -X sessionname averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa $ echo $? 0 $ ./screen -ls There is a screen on: 19318.averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (Detached) 1 Socket in /tmp/uscreens/S-alex. $ ./screen -r 19318.averyverylongsesssionnameaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ... I see ping again... press Ctrl-C... [screen is terminating] _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?61534> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/