Merged, thanks!
remove extendedglob, too advanced
Kicksecure:master
â nyxnor:master
Merged, thanks!
sudo apt-get-reset desktop-config-dist
Now I keep getting this prompt:
This is the Z Shell configuration function for new users,
zsh-newuser-install.
But itâs weird because otherwise all functionality (colors, command completion) are functional as expected.
Any idea?
For testing, please make sure you donât have a local ~/.zshrc
file. That would avoid reproduction of this issue.
ls ~/.zshrc
At which moment do you get this prompt?
I deleted ~/.zshrc and ran zsh but not warning appeared.
Edit: on one machine I could reproduce.
Will disable the zsh-newuser module as per man:
WHEN THE SHELL STARTS
When it starts, the shell reads commands from various files. These can be created or
edited to customize the shell. See the section Startup/Shutdown Files in zsh(1).
If no personal initialization files exist for the current user, a function is run to help
you change some of the most common settings. It won't appear if your administrator has
disabled the zsh/newuser module. The function is designed to be self-explanatory. You
can run it by hand with `autoload -Uz zsh-newuser-install; zsh-newuser-install -f'. See
also the section User Configuration Functions in zshcontrib(1).
THE ZSH/NEWUSER MODULE
The zsh/newuser module is loaded at boot if it is available, the RCS option is set, and
the PRIVILEGED option is not set (all three are true by default). This takes place immeâ
diately after commands in the global zshenv file (typically /etc/zsh/zshenv), if any, have
been executed. If the module is not available it is silently ignored by the shell; the
module may safely be removed from $MODULE_PATH by the administrator if it is not required.
On loading, the module tests if any of the start-up files .zshenv, .zprofile, .zshrc or
.zlogin exist in the directory given by the environment variable ZDOTDIR, or the user's
home directory if that is not set. The test is not performed and the module halts proâ
cessing if the shell was in an emulation mode (i.e. had been invoked as some other shell
than zsh).
If none of the start-up files were found, the module then looks for the file newuser first
in a sitewide directory, usually the parent directory of the site-functions directory, and
if that is not found the module searches in a version-specific directory, usually the parâ
ent of the functions directory containing version-specific functions. (These directories
can be configured when zsh is built using the --enable-site-scriptdir=dir and --enâ
able-scriptdir=dir flags to configure, respectively; the defaults are prefix/share/zsh and
prefix/share/zsh/$ZSH_VERSION where the default prefix is /usr/local.)
If the file newuser is found, it is then sourced in the same manner as a start-up file.
The file is expected to contain code to install start-up files for the user, however any
valid shell code will be executed.
The zsh/newuser module is then unconditionally unloaded.
Note that it is possible to achieve exactly the same effect as the zsh/newuser module by
adding code to /etc/zsh/zshenv. The module exists simply to allow the shell to make arâ
rangements for new users without the need for intervention by package maintainers and sysâ
tem administrators.
The script supplied with the module invokes the shell function zsh-newuser-install. This
may be invoked directly by the user even if the zsh/newuser module is disabled. Note,
however, that if the module is not installed the function will not be installed either.
The function is documented in the section User Configuration Functions in zshcontrib(1).
still searching how to disable a zsh module
Trying to avoid this debian - Disable the configuration tool in Zsh - Unix & Linux Stack Exchange
changing /etc/zsh/zshenv because the answer is not good at all, it will clear the function and the user wonât be able to use it if they want to run manually.
https://www.zsh.org/mla/users/2007/msg00398.html
https://www.zsh.org/mla/users/2007/msg00400.html
Upstream did not give a good response, just simply remote the file they said, but does not fix pkg mngmt problems after package is reinstalled, will require a patch on /usr/share/zsh/5.8/scripts/newuser
, but the bad thing is that the path is by version and this could soon lead to an error for Zsh 5.9.
Can we simply touch ~/.zshrc
again?
File ~/.zshrc
seems the best solution indeed after checking your research on this issue.
Not sure we can run touch ~/.zshrc
from debian postinst script. Would be touch /home/user/.zshrc
. But the APT sandbox (probably) might block it similarly to:
Would could add .zshrc' to
/etc/skel`. I.e.
/etc/skel/.zshrc
A skel based solution would also be compatible with multi-user setups.
That would work for new builds. So zsh could be enabled by default in the next point release.
As for changing existing users default shell from bash to zsh, I am not sure thatâs important or if we even should do that. If so, weâd need to add the csh
and touch
command here: legacy-dist/usr/libexec/legacy-dist/fixes at master ¡ Kicksecure/legacy-dist ¡ GitHub (as it wonât work from APT).
I think it is /home/$USER/.zshrc
/etc/skel/.zshrc
created empty
APT / deb postinst scripts doesnât have a $USER
variable.
/etc/skel/.zshrc
created empty
Great, merged!
Small issueâŚ
functional in bash:
git verify-commit 16.0.8.2-stable^{commit}
broken in zsh:
git verify-commit 16.0.8.2-stable^{commit}
zsh: no matches found: 16.0.8.2-stable^{commit}
zsh: exit 1 git verify-commit 16.0.8.2-stable^{commit}
Needs to be quoted in zsh. Functional:
git verify-commit "16.0.8.2-stable^{commit}"
Is it possible to change zsh behavior here?
Found this
https://zsh.sourceforge.io/Guide/zshguide05.html#l137
Apparently ^
means negation.
So
[^[:digit:]]`' matches any single character other than a decimal digit. Standards say you should use
!' instead of ``^
â to signify negation, but most people I know donât; also, this can clash with history substitution. However, it is accepted by zsh anywhere where history substitution doesnât get its hands on the ``!`â first (which includes all scripts and autoloaded functions).
And also
Another two cryptic symbols are the two that do negation. These only work with the option ``EXTENDED_GLOB`â set: this is necessary to get the most out of zshâs patterns, but it can be a trap for the unwary by turning otherwise innocuous characters into patterns:
print ^foo
This means any file in the current directory except the file
foo
. One way of coming unstuck with ``^`â is something like
stty kill ^u
where you would hope
^u`' means control with
u', i.e. ASCII character 21. But it doesn't, if
EXTENDED_GLOBis set: it means
any file in the current directory except one called ``u`â ', which is definitely a different thing.
So if you want to not have to quote you can insert unsetopt extendedglob
in your ~/.zshrc
as it will override the option set on /etc/zsh/zshrc.dist
.
Or if you prefer to remove from the default build?
Whatâs the zsh default?
Maybe best to stick to zsh defaults?
zsh default is thin, slim, so not set.
so should I remove it?
Yes, please. Otherwise I guess too some commands that users/copy paste might break. Even if the scripting is different, should be similar enough to bash in order not to break things.
Note: Since this is related⌠No, zsh wonât break random shell scripts.
breaking bash scripts: each script nowadays has a shebang in its first line such as for example /usr/sbin/apparmor-info is a bash script, its first line is
#!/bin/bash
. Therefore the script will still run under bash, not zsh.
(nyxnor knows that but mentioning here in case somebody else would wonder.)
Kicksecure:master
â nyxnor:master