From: Achim Gratz <Stromeko@nexgo.de>
To: cygwin@cygwin.com
Subject: Re: /etc/profile
Date: Sat, 25 Aug 2012 21:26:00 -0000 [thread overview]
Message-ID: <87ipc71lhy.fsf@Rainer.invalid> (raw)
In-Reply-To: <87mx1j1na7.fsf@Rainer.invalid>
[-- Attachment #1: Type: text/plain, Size: 94 bytes --]
Achim Gratz writes:
[...]
Hit send too soon... here's the patch set again without the typos.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Protect-ORIGINAL_PATH-and-control-behaviour-by-CYGWI.patch --]
[-- Type: text/x-patch, Size: 1342 bytes --]
From 8a930eb8adc4d9364ea0d6c8f63be448c539b448 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sat, 25 Aug 2012 08:19:12 +0200
Subject: [PATCH 1/3] Protect ORIGINAL_PATH and control behaviour by
CYGWIN_NOWINPATH
* etc/defaults/etc/profile: Protect an existing ORIGINAL_PATH
variable. Strip windows PATH only from Cygwin path if variable
CYGWIN_NOWINPATH is set.
---
etc/defaults/etc/profile | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
mode change 100644 => 100755 etc/defaults/etc/profile
diff --git a/etc/defaults/etc/profile b/etc/defaults/etc/profile
old mode 100644
new mode 100755
index b5a803d..5458446
--- a/etc/defaults/etc/profile
+++ b/etc/defaults/etc/profile
@@ -29,8 +29,14 @@
# software to override 'system' software.
# Modifying these default path settings can be done in different ways.
# To learn more about startup files, refer to your shell's man page.
-ORIGINAL_PATH="${PATH}"
-PATH="/usr/local/bin:/usr/bin"
+if [ "${ORIGINAL_PATH-null}" = "null" ]; then
+ ORIGINAL_PATH="${PATH}"
+fi
+if [ "${CYGWIN_NOWINPATH-null}" = "null" ];then
+ PATH="/usr/local/bin:/usr/bin:${PATH}"
+else
+ PATH="/usr/local/bin:/usr/bin"
+fi
MANPATH="/usr/local/man:/usr/share/man:/usr/man:${MANPATH}"
INFOPATH="/usr/local/info:/usr/share/info:/usr/info:${INFOPATH}"
--
1.7.11.5
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Do-not-set-LC_ALL-unconditionally.patch --]
[-- Type: text/x-patch, Size: 1166 bytes --]
From c3a3b56e8402f373507585bbeee5509e0df22412 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sat, 25 Aug 2012 08:21:08 +0200
Subject: [PATCH 2/3] Do not set LC_ALL unconditionally
* etc/defaults/etc/profile: Avoid setting LC_ALL if it wasn't set to begin with.
---
etc/defaults/etc/profile | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/etc/defaults/etc/profile b/etc/defaults/etc/profile
index 5458446..c3d9c47 100755
--- a/etc/defaults/etc/profile
+++ b/etc/defaults/etc/profile
@@ -107,12 +107,19 @@ fi
# Shell dependent settings
profile_d ()
{
- _LC_SAVE_="{LC_ALL}"
+ _LC_SAVE_="${LC_ALL-null}"
LC_ALL=C
- for file in /etc/profile.d/*.$1); do
- [ -e "${file}" ] && LC_ALL="${_LC_SAVE_}" . "${file}"
- done
- LC_ALL="{_LC_SAVE_}"
+ if [ "${_LC_SAVE_}" = "null" ]; then
+ for file in /etc/profile.d/*.$1; do
+ [ -e "${file}" ] && . "${file}"
+ done
+ unset LC_ALL
+ else
+ for file in /etc/profile.d/*.$1; do
+ [ -e "${file}" ] && LC_ALL="${_LC_SAVE_}" . "${file}"
+ done
+ LC_ALL="${_LC_SAVE_}"
+ fi
unset file
unset _LC_SAVE_
}
--
1.7.11.5
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Do-not-set-PS1-for-non-interactive-shells.patch --]
[-- Type: text/x-patch, Size: 1809 bytes --]
From f03f4ab0b47312959dd9d57a520af3f4a4c50011 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Sat, 25 Aug 2012 08:35:02 +0200
Subject: [PATCH 3/3] Do not set PS1 for non-interactive shells
* etc/defaults/etc/profile: Do not set PS1 for non-interactive shells.
Zsh is in sh compatibility mode when it sources /etc/profile, so
don't use zsh extensions. Posh should also run profile_d.
---
etc/defaults/etc/profile | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/etc/defaults/etc/profile b/etc/defaults/etc/profile
index c3d9c47..1e63c32 100755
--- a/etc/defaults/etc/profile
+++ b/etc/defaults/etc/profile
@@ -124,25 +124,20 @@ profile_d ()
unset _LC_SAVE_
}
+HOSTNAME="$(/usr/bin/hostname)"
+profile_d sh
if [ ! "x${BASH_VERSION}" = "x" ]; then
- HOSTNAME="$(/usr/bin/hostname)"
- profile_d sh
[ -f "/etc/bash.bashrc" ] && . "/etc/bash.bashrc"
elif [ ! "x${KSH_VERSION}" = "x" ]; then
typeset -l HOSTNAME="$(/usr/bin/hostname)"
- profile_d sh
- PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n$ ')
+ [ "${PS1-null}" = "null" ] || PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n$ ')
elif [ ! "x${ZSH_VERSION}" = "x" ]; then
- HOSTNAME="$(/usr/bin/hostname)"
+ # zsh is in shell compatibility mode here, so we probably shouldn't do this
profile_d zsh
- PS1='(%n@%m)[%h] %~ %% '
elif [ ! "x${POSH_VERSION}" = "x" ]; then
- HOSTNAME="$(/usr/bin/hostname)"
- PS1="$ "
+ {}; #[ "${PS1-null}" = "null" ] || PS1="$ "
else
- HOSTNAME="$(/usr/bin/hostname)"
- profile_d sh
- PS1="$ "
+ {}; #[ "${PS1-null}" = "null" ] || PS1="$ "
fi
export PATH MANPATH INFOPATH USER TMP TEMP PRINTER HOSTNAME PS1 SHELL tmp temp
--
1.7.11.5
[-- Attachment #5: Type: text/plain, Size: 187 bytes --]
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra
[-- Attachment #6: Type: text/plain, Size: 218 bytes --]
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
next prev parent reply other threads:[~2012-08-25 7:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-21 15:03 /etc/profile Achim Gratz
2012-08-21 15:35 ` /etc/profile Eric Blake
2012-08-21 15:57 ` /etc/profile Achim Gratz
2012-08-21 16:11 ` /etc/profile James Johnston
2012-08-21 16:50 ` /etc/profile Eric Blake
2012-08-21 17:21 ` /etc/profile Achim Gratz
2012-08-21 19:27 ` /etc/profile Eric Blake
2012-08-21 20:48 ` /etc/profile Achim Gratz
2012-08-21 17:24 ` /etc/profile Earnie Boyd
2012-08-22 19:42 ` /etc/profile David Sastre Medina
2012-08-22 20:10 ` /etc/profile Achim Gratz
2012-08-22 20:15 ` /etc/profile David Sastre Medina
2012-08-22 20:50 ` /etc/profile Achim Gratz
2012-08-25 15:45 ` /etc/profile Achim Gratz
2012-08-25 21:26 ` Achim Gratz [this message]
2012-08-22 20:36 ` /etc/profile Daniel Colascione
2012-08-22 20:51 ` /etc/profile Achim Gratz
2012-08-22 20:55 ` /etc/profile Andrey Repin
2012-08-22 22:52 ` /etc/profile Achim Gratz
2012-08-22 20:55 ` /etc/profile Christopher Faylor
2012-08-22 21:18 ` /etc/profile Achim Gratz
2012-08-23 6:35 ` /etc/profile Andrew DeFaria
2012-08-22 22:08 ` /etc/profile David Sastre Medina
2012-08-23 5:54 ` /etc/profile Christopher Faylor
2012-08-23 6:19 ` /etc/profile David Sastre Medina
2012-08-23 10:03 ` /etc/profile Achim Gratz
2012-08-23 10:29 ` /etc/profile L Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ipc71lhy.fsf@Rainer.invalid \
--to=stromeko@nexgo.de \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).