#705968 schroot: --session-name should work with automatic sessions

Package:
schroot
Source:
schroot
Description:
Execute commands in a chroot environment
Submitter:
Roger Leigh
Date:
2015-12-28 15:21:11 UTC
Severity:
wishlist
#705968#5
Date:
2013-04-22 21:17:03 UTC
From:
To:
Currently, --session-name only works when using manual session
creation.  It does not work with automatic sessions.  It would
be useful for --session-name to work for automatic sessions
as well, and for the option handling code to relax its checking
to allow for this use case, and additionally for the option to
be set in the session object for it to take effect.


Roger

#705968#10
Date:
2015-12-28 15:19:12 UTC
From:
To:
How about the following patch?

(against 1.6.10-1)
[[[
--- bin/schroot/schroot-options-base.cc
+++ bin/schroot/schroot-options-base.cc
@@ -261,7 +261,8 @@ options_base::check_actions ()
       throw error(_("Unknown action specified"));
     }

-  if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN)
+  if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN &&
+      this->action != ACTION_SESSION_AUTO)
     throw error
       (_("--session-name is not permitted for the specified action"));
]]]

(against 1.7.2-3)
[[[
diff --git a/lib/schroot-common/options.cc b/lib/schroot-common/options.cc
index b0af5ae..02996af 100644
--- a/lib/schroot-common/options.cc
+++ b/lib/schroot-common/options.cc
@@ -263,6 +263,7 @@ namespace schroot_common
         throw error(_("Unknown action specified"));
       }

-    if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN)
+    if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN &&
+        this->action != ACTION_SESSION_AUTO)
       throw error
         (_("--session-name is not permitted for the specified action"));
]]]

In a quick test, it functions as expected:

[[[
% sudo usr/bin/schroot -c unstable-amd64-sbuild -n foo
(unstable-amd64-sbuild)root@host:~# env | grep -i schroot
⋮
SCHROOT_SESSION_ID=foo
]]]

I tested the 1.6.10-1 patch.  Where would I find an upstream tarball of
1.7.2, to test the 1.7.2-3 patch with?  It wasn't clear to me from
the existing docs (HACKING, d/README.source, d/control, d/watch).

Cheers,

Daniel

#705968#17
Date:
2015-12-28 15:19:18 UTC
From:
To:
How about the following patch?

(against 1.6.10-1)
[[[
--- bin/schroot/schroot-options-base.cc
+++ bin/schroot/schroot-options-base.cc
@@ -261,7 +261,8 @@ options_base::check_actions ()
       throw error(_("Unknown action specified"));
     }

-  if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN)
+  if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN &&
+      this->action != ACTION_SESSION_AUTO)
     throw error
       (_("--session-name is not permitted for the specified action"));
]]]

(against 1.7.2-3)
[[[
diff --git a/lib/schroot-common/options.cc b/lib/schroot-common/options.cc
index b0af5ae..02996af 100644
--- a/lib/schroot-common/options.cc
+++ b/lib/schroot-common/options.cc
@@ -263,6 +263,7 @@ namespace schroot_common
         throw error(_("Unknown action specified"));
       }

-    if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN)
+    if (!this->session_name.empty() && this->action != ACTION_SESSION_BEGIN &&
+        this->action != ACTION_SESSION_AUTO)
       throw error
         (_("--session-name is not permitted for the specified action"));
]]]

In a quick test, it functions as expected:

[[[
% sudo usr/bin/schroot -c unstable-amd64-sbuild -n foo
(unstable-amd64-sbuild)root@host:~# env | grep -i schroot
⋮
SCHROOT_SESSION_ID=foo
]]]

I tested the 1.6.10-1 patch.  Where would I find an upstream tarball of
1.7.2, to test the 1.7.2-3 patch with?  It wasn't clear to me from
the existing docs (HACKING, d/README.source, d/control, d/watch).

Cheers,

Daniel