I actually asked in the chat first (see above) but it's the first time I tried using the chat function. Can someone be invited in the chat by simply typing his nickname?
@PavelŠimerda If they've been in the chat room recently that will work (you can tell because their name will autocomplete), otherwise it's complicated: You can create an actual chat room but AFAICT there is no way to invite anyone to it directly. Maybe someone here knows of a way so I can bug anyone, anytime ;)
apache seems to have a sligthtly bigger usage preference over httpd, most questions are tagged with both. By the way, I'd prefer apache to be synonym to httpd, not the opposite.
EDIT:
My point is that Apache is more that just the http server sub-project; apache-httpd would be a better tag. Yet,...
I currently am running a number of virtual machines from an Arch Linux based install of Xen. The Dom0 host is running a number of DomU guests including a NAS, a MythTv backend, another full Linux desktop install of Arch, and a Windows XP machine. The Dom0 has a single network interface that is br...
@StrongBad Not in my wheelhouse but maybe you should delete that and ask a new question, using your last comment: "I want all my DomUs and my Dom0 to have internet access and I want all network traffic to go through the DomU router. How many NICs do I need for this and how do I configure them?" You probably do not have to ramble about specifics, just say, "The Dom0 host is running a number of DomU guests", period.
@TAFKA'goldilocks' I just flagged it as possibly needing an account merge...
@TAFKA'goldilocks' Thanks for the suggestion. I can try that as the edit. I would prefer not to delete the question since it does have an answer. although one that is not particularly helpful to me yet.
@StrongBad @Braiam Oh you mean those are two separate "Utkarsh Kattishettar" accounts! No I missed that. If a moderator can fix that it would be good, I'll flag too.
@TAFKA'goldilocks' I don't know of a way to ping people without commenting on their questions or answer, or adding a comment to comment thread which they are already a part of.
Fuck I placed the flag on the wrong page by accident and there is no way to undo it or add another flag indicating the mistake, lol. This place is occasionally glaringly dsyfunctional:
I'm wondering (since it just happened to me), is it possible to "cancel" ("undo", "delete", whatever) a flag I just raised if I misclicked it, so the mods won't waste time?
I looked everywhere, but I can't find such a feature.
@TAFKA'goldilocks' - yes this is extremely annoying that you cannot revert or undo on that activity when you can rollback edits and such. Extremely annoying.
@HaukeLaging Yeah, if I saw somebody else complain about it I'd just shrug. Either they've backed themselves into a corner with the implementation (I dunno if that is public), or they are just lazy, since the excuse is "Oh it doesn't really matter...". Anyway, +1 for asking. BTW, I found some stuff in man bash about where $PS1 comes from originally -- see my edited answer. I'm right :P ...probably
@Braiam it should, all its shells are login shells so bash should source bash_profile if present.
Oh, you mean during boot? Not sure but probably not since there will be no login session and the scripts are just interpreted directly, .bash_profile is not read for non-interactive shells.
@Braiam yes, the answer you linked to would probably work but not because .bash_profile is sourced at boot, because it is sourced every time you open a terminal window.
openssh (1:6.6p1-2) unstable; urgency=medium
* If no root password is set, then switch to "PermitRootLogin
without-password" without asking (LP: #1300127).
-- Colin Watson <[email protected]> Mon, 31 Mar 2014 12:20:46 +0100
@HaukeLaging What is it that calls execv()? If it's the kernel, it still uses clone somewhere, which implies it would just inherit the original environment. But obviously that is not what happens. If it's a subshell, then that is an explanation. Your answer as it exists now does not explain anything it just re-describes the phenomenon. You don't provide any references, etc. If you can prove to me that it means something different than what I've said, I'd be happy to eat my words and...
...delete my answer, because there is an ambiguity in here.
However, the bash docs WRT to PS1, etc seem pretty definitive, meaning env is exec'd by a subshell and that subshell is non-interactive.
@HaukeLaging All you've said is that processes can be observed to execute with a more limited environment than the shell which executed them. The question is how and why.
@HaukeLaging Very specifically, the question revolves around env, which is an independent process, and my thesis is it's executed by a non-interactive subshell.
@TAFKA'goldilocks' IMHO it does not make sense to argue with shell initialization because that effect is specific to shells. The real difference is internal vs. exported variables in a shell, though.
@TAFKA'goldilocks' The shell executes external commands (like env) and internal commands (like set) and that's why these commands see different envorinments. Agree?
@HaukeLaging You are saying the difference involves "internal vs. exported variables" -- correct, in part. So where do the variables env and other process come from?export affects subshell environments.
@HaukeLaging Yes, but how does it execute them? It cannot call execv itself, that is the end of the line for a process. And what is the environment in which an executed process exists?
@TAFKA'goldilocks' I guess that is wrong (i.e. the wording doesn't make sense): In subshells the environment is the same. No matter whether a variable is exported or not. It seems important to me to tell subshells (internal effects like pipelines) apart from general subprocesses.
@TAFKA'goldilocks' The shell clones (and thus has the same env) and then does execve which "resets" the environment. All internal variables are gone after the execve, even if the new process is the same kind of shell.
Example: PS1="foo "; (echo $PS1) That's what I mean by subshell. Though PS1 is not exported it stays the same.
@TAFKA'goldilocks' The shell sets the environment of an external command to (a) all exported variables) plus (b) variables defined on the command line: LC_ALL=C ls -l
@HaukeLaging That's an interesting case too. What I'm getting from the exec() docs is that (e.g.) execvpe() will allow the calling process to redefine the environment. So that's one way it could be "reset". But I think that's not what happens. The subshell that executes it already has a limitied environment. The exec() call does not affect this at all.
@TAFKA'goldilocks' "Sets the env" is better wording than "resets the env"
@TAFKA'goldilocks' OK, you think the subshell is limited. Please be precise about what you think is different in the subshell. And again: I think your usage of the term "subshell" is dangerous. A shell being cloned just for the purpose of an execve to a new program can IMHO not usefully be called a "subshell".
@HaukeLaging Sets the environment how? Via execvpe(), or by forking and executing a non-interactive subshell.
* Please be precise about what you think is different in the subshell.* As I've said, it's non-interactive. All it's environment characteristics match this thesis exactly. One way or the other, the intention is to have the process execute in the same env as a non-interactive shell. Whether that's because of an intermediate subshell, or execvpe() I dunno. *But it is not automatic magic carried out by just any exec call.
@TAFKA'goldilocks' That's not part of my man page (2013-07-04). It sounds to me like that execve is the only way to change the environment for a new process. Doesn't your shell use execve?
@TAFKA'goldilocks' "int execve(const char *filename, char *const argv[], char *const envp[]);" envp is an array of strings, conventionally of the form key=value, which are passed as environment to the new program.
@TAFKA'goldilocks' To me a subshell is (a;b) or foo="$(bar)". I have never thought of these subshells as interactive or non-interactive. But they are whatever the calling shell is. This is usually not done (at least not by me) but: (echo -n "Enter your name: "; read name)`
@HaukeLaging Just in case you this point is not clear to you: the shell where you issue the command cannot be the one calling execv(). It MUST be a subshell.
@TAFKA'goldilocks' Again: In my understanding of the problem / the question the invocation part is irrelevant as it affects a new shell only but not e.g. env. The subshell (as you call it) which does the execve does not do a new invocation procedure.
@HaukeLaging Okay, so you are saying the fork() of the shell which calls exec() is not "a subshell". I can agree w/ that. Except I think that's not quite what actually happens.
I'm saying the shell intentionally forks and executes a new subshell to delimit the environment of the process it's going to execute. This is where I would be wrong ;)
@HaukeLaging True, but what the language refers to does. The word "car" is not a car, but when I say, "Get in the car", I mean a real thing. I may in fact be abusing the term "subshell" in that sense. If it is just a fork of the shell, it's not really a subshell. I guess.
@TAFKA'goldilocks' It's the other way round: First there is the fork (or rather: clone). The result is a "temporary subshell" which does the execve. There is no execve to a shell (unless you explicitely call a new shell: > bash).
@HaukeLaging Okay, so let's call it a "temporary subshell". It either a) starts with a different environment than its parent, or B) changes the environment to match the "non-interactive" state before it calls execv
@HaukeLaging Yeah, I'm gonna change that and throw in the **environ stuff for good measure, but first I'd like to know how that gets set. It does not contain nothing. It came from somewhere, and it does not match the environment of the original shell BUT hey I got it..
@TAFKA'goldilocks' A clone / fork cannot have a different environment. It can just pass a modified one to execve (or modify its own and use another variant of exec).
Here's what happens: the interactive shell you use is spawned in a non-interactive context, then it sources files appropriate to it's interactive state. I've read before the shell decides the difference based on it's relationship to a terminal. So the parent shell has PS1 set, and this is also in the fork, but it is not in **environ.
@HaukeLaging No, that's the whole point of the question. It does not contain $PS1, but if you echo $PS1 in the same shell, there it is. An environment variable.
@TAFKA'goldilocks' PS1 is technically not part of the shell environment (i.e. you don't see it in /proc/$$/environ). You can use PS1 nonetheless because it is an internal shell variable.
@TAFKA'goldilocks' If you export PS1 then the environment of the shell is not changed. But if an external command is called then those variables which have been marked as exported are copied to the envp[] array of execve.
@TAFKA'goldilocks' Every environment is the result of the environment with which that process was started plus the changes it made. I don't know whether PID 1 initially has an environment.
@TAFKA'goldilocks' I think we are clear now. And I have to leave for a while anyway.
@HaukeLaging PID 1 initially has an environment No, not much of one. But along the way it executes shells, e.g., your login, which is interactive. But the shell which (e.g.) X executes via startx is non-interactive.
And: the interactive parts are never sourced into **environ.
The primary issue here -- which accounts for why, e.g., $PS1 is not reported by env -- is that env is reporting from a non-interactive environment. Processes are executed from a fork of your interactive shell, but there's a subtlety involved in how their environment is set: It's actually inherit...
I've deleted my comments which applied to the previous version, and the one on your A. Would much appreciate it if you do the same since they now do not make much sense.