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
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
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