Control: tag -1 + patch moreinfo

Hi again,

Daniel and others who might be affected by that regression: Please
test the patch at the end of the mail if it suffices to fix your issue
with regards the API and if it doesn't cause any other regressions.

Axel Beckert wrote:
> Axel Beckert wrote:
> > > but if you have any pre-existing code that does something like:
> > > 
> > >     screen -L -c foo.screenrc
> > > 
> > > then it fails in 4.5.0 because it doesn't like -c as an argument to
> > > -L.
[...]
> > Seem to be these commits:
> > 
> > Code change:
> > http://git.savannah.gnu.org/cgit/screen.git/commit/?h=screen-v4&id=18193bc7b237d66a076fffa21d4308dbb4f83cc5
> 
> Unfortunately this commit doesn't apply to 4.5.0. But I noticed
> there's an earlier and much smaller commit which explicitly targets the
> API regression:
> 
> http://git.savannah.gnu.org/cgit/screen.git/commit/?h=screen-v4&id=c14e05e7c36c64d85198ed0fc89177427ece48d4
> 
> I'll check if that also suffice.

Unfortunately not. While it seems to suffice for case reported at
upstream, it does not suffice for your case:

Calling "screen -L -c foo.screenrc" with that patch applied starts a
screen session, which immediately shows the message "Cannot exec
'foo.screenrc': No such file or directory" in the status line and then
exits again.

But as far as I understand the code it was just forgetten to revert
the two counters if the argument after -L starts with a dash. So
adding

  av--;
  ac++;

(and curly braces) to that if clause seems to do it for my quick
tests.

Full patch as planned:

Origin: c14e05e7c36c64d85198ed0fc89177427ece48d4
Author: Alexander Naumov <alexander_nau...@opensuse.org>
Description: Ignore logfile's name that begins with the "-" symbol
 This fixes the API:
 .
 To enable logging we use -L option. But in case of
 default logfile name (screenlog.0) we will need to
 define it anyway. Because screen will try to interpret
 next option as a parameter for -L option (which is
 logfile name). It will fails ALWAYS, because next
 parameter will always start with "-" symbol...
 what is not permited for logfile name of course.
 .   
 For example:
 .
 $ screen -L -D -m ./configure
 .
 In this case logfile name is screenlog.0, because "-D"
 will not be interpreted by screen as a name of logfile.
Bug-Debian: https://bugs.debian.org/863095
Bug: https://savannah.gnu.org/bugs/?50440
Reviewd-By: Axel Beckert <a...@debian.org>

--- a/doc/screen.1
+++ b/doc/screen.1
@@ -262,8 +262,8 @@
 tells
 .I screen
 to turn on automatic output logging for the windows. By default, logfile's name
-is screenlog.1. You can sets new name: add it right after -L option e.g. 
"screen
--L my_logfile".
+is screenlog.0. You can set new name: add it right after -L option e.g. "screen
+-L my_logfile". Keep in mind that name can not start with "-" symbol.
 .TP 5
 .B \-m
 causes
--- a/doc/screen.texinfo
+++ b/doc/screen.texinfo
@@ -334,7 +334,9 @@
 
 @item -L
 Tell @code{screen} to turn on automatic output logging for the
-windows.
+windows. By default, logfile's name is screenlog.0. You can set new name:
+add it right after -L option e.g. "screen -L my_logfile". Keep in mind
+that name can not start with "-" symbol.
 
 @item -m
 Tell @code{screen} to ignore the @code{$STY} environment variable.  When
--- a/screen.c
+++ b/screen.c
@@ -669,8 +669,11 @@
           case 'L':
             if (--ac != 0) {
               screenlogfile = SaveStr(*++av);
-              if (screenlogfile[0] == '-')
-                Panic(0, "-L: logfile name can not start with \"-\" symbol");
+              if (screenlogfile[0] == '-') {
+                screenlogfile = SaveStr("screenlog.%n");
+                av--;
+                ac++;
+              }
               if (strlen(screenlogfile) > PATH_MAX)
                 Panic(0, "-L: logfile name too long. (max. %d char)", 
PATH_MAX);
             }

You can also checkout the whole source package with that patch from
the branch "stretch-planned" in the packaging git repo:

https://anonscm.debian.org/cgit/collab-maint/screen.git/log/?h=stretch-planned

                Regards, Axel
-- 
 ,''`.  |  Axel Beckert <a...@debian.org>, http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE

Attachment: signature.asc
Description: Digital signature

Reply via email to