bugGNU Screen - Bugs: bug #23939, screen -xRR versus screen -RRx,...

 
 

bug #23939: screen -xRR versus screen -RRx, rflag funkiness

Submitter:  Micah Cowan <micahcowan>
Submitted:  Sat 26 Jul 2008 06:32:11 PM UTC
   
 
Category:  Program Logic Severity:  2 - Minor
Priority:  * 5 - Normal Status:  Confirmed
Privacy:  Public Assigned to:  None
Open/Closed:  Open Release:  None
Fixed Release:  None Planned Release:  Later
Work Required:  0 - Hours
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 22 Jun 2024 08:36:56 PM UTC, comment #4: 

Screen version 4.99.0

Flags -xRR and -RRx behaviour is still different, as in original submission - -RRx replies with "There is no screen to be attached.", meanwhile -xRR creates session.

Julian <juyret>
Mon 07 Sep 2009 03:27:20 AM UTC, comment #3: 

This is a bit more complete. It removes the possibility of rflag being equal to 3, the behavior of which, AFAICT, isn't defind.

Any -R overrides any -r.

Multiple/extra instances of -r are ignored (-rr is the same as -r).

There is still an implicit -r with -x.


--- a/src/screen.c
+++ b/src/screen.c
@@ -678,24 +692,24 @@ char **av;
                 case 'q':
                   quietflag = 1;
                   break;
-                case 'r':
                 case 'R':
+                  rflag = (rflag/2) ? 4 : 2;
+                  /* FALLTHROUGH */
 #ifdef MULTI
                 case 'x':
+                  if (*ap == 'x')
+                      xflag = 1;
+                  /* FALLTHROUGH */
 #endif
+                case 'r':
+                  if (!rflag)
+                    rflag = 1;
                   if (ac > 1 && *av[1] != '-' && !SockMatch)
                     {
                       SockMatch = *++av;
                       ac--;
-                      debug2("rflag=%d, SockMatch=%s\n", dflag, SockMatch);
+                      debug2("rflag=%d, SockMatch=%s\n", rflag, SockMatch);
                     }
-#ifdef MULTI
-                  if (*ap == 'x')
-                    xflag = 1;
-#endif
-                  if (rflag)
-                    rflag = 2;
-                  rflag += (*ap == 'R') ? 2 : 1;
                   break;
 #ifdef REMOTE_DETACH
                 case 'd':


Max Kalashnikov <maxkalashnikov>
Sat 29 Aug 2009 06:09:35 PM UTC, comment #2: 

Thanks, Max; but file-scope (statically-allocated) variables are automatically initialized to zero; only automatically-allocated variables (stack storage) require explicit initialization; this change wouldn't alter behavior.

Micah Cowan <micahcowan>
Sat 29 Aug 2009 03:01:51 AM UTC, comment #1: 

In screen.c:


                  rflag += (*ap == 'R') ? 2 : 1;


This appears to add to rflag, which might not already be initialized, accounting for inconsistency.

Patch attached.


(file #18656)

Max Kalashnikov <maxkalashnikov>
Sat 26 Jul 2008 06:32:11 PM UTC, original submission:  
Micah Cowan <micahcowan>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #18656:  screen-rflag.diff added by maxkalashnikov (313B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by juyret (Posted a comment)
  • -email is unavailable- added by maxkalashnikov (Updated the item)
  • -email is unavailable- added by micahcowan (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-08-29 maxkalashnikov Attached File- Added screen-rflag.diff, #18656
    2009-02-22 micahcowan Planned Release4.1.0 Later

    Back to the top

    Powered by Savane 3.13-081f.
    Corresponding source code