Bug 463167 - %M and %m expansions don't work anymore
%M and %m expansions don't work anymore
Product: Fedora
Classification: Fedora
Component: zsh (Show other bugs)
All Linux
medium Severity low
: ---
: ---
Assigned To: James Antill
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-09-22 09:36 EDT by Mathieu Chouquet-Stringer
Modified: 2008-09-25 07:15 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-09-25 07:15:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mathieu Chouquet-Stringer 2008-09-22 09:36:32 EDT
Description of problem:
On a freshly installed F9, print -P "%M %m" returns nothing while on a RHEL 5.2 (for instance) it gives you the FQDN then the hostname.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. print -P "%M %m"
Actual results:
Empty strings

Expected results:
As per the man page:

       %M     The full machine hostname.

       %m     The hostname up to the first ‘.’.  An integer may follow the ‘%’ to specify how many components of the hostname are desired.
              With a negative integer, trailing components of the hostname are shown.
Comment 1 James Antill 2008-09-22 10:17:04 EDT
% print -P "%M %m"                         
code.and.org code
% yum list zsh
Installed Packages
zsh.x86_64                         4.3.4-8.fc9                         installed

...got anymore info?
Comment 2 Mathieu Chouquet-Stringer 2008-09-22 10:27:15 EDT
zsh.i386                                 4.3.4-8.fc9            installed       

On my machine (I've got another one at home):

%print -P "%M"


And foobar is in /etc/hosts (I mean a getent ahosts foobar works)...

I guess I'm going to dig in the source...
Comment 3 Mathieu Chouquet-Stringer 2008-09-22 10:42:28 EDT
BY the way I also tried to move my .zshrc out of the way, same result...
Comment 4 James Antill 2008-09-22 11:08:56 EDT
 Ok, interesting ... if I do "zsh -f" then print "%M" just prints %M.

       Prompt  sequences  undergo  a  special form of expansion.  This type of
       expansion is also available using the -P option to the print builtin.

...and print -P "%M" works in zsh -f.
Comment 5 Mathieu Chouquet-Stringer 2008-09-22 11:42:52 EDT
Nice find, with zsh -f, print -P "%M" works again...
Comment 6 Mathieu Chouquet-Stringer 2008-09-24 05:15:49 EDT
Found the culprit, I added this to zshrc:
--- zshrc.orig  2008-05-16 06:17:09.000000000 +0200
+++ zshrc       2008-09-24 11:10:39.000000000 +0200
@@ -26,7 +26,9 @@
     if [[ ! -o login ]]; then # We're not a login shell
         for i in /etc/profile.d/*.sh; do
            if [ -r "$i" ]; then
+               echo $i
                . $i
+               print -P "%M %m"
         unset i

And basically it stops here:
tangerine tangerine

So keychain seems to be at fault.  The issue is this line:

If you unset HOST, print -P "%M" (or %m) fails...

%echo $HOST

%print -P "%m %M"
%print -P "%m %M"
foobar foobar

Can we transfer this bug to keychain instead of rpm?
Comment 7 Mathieu Chouquet-Stringer 2008-09-24 05:23:05 EDT
I meant "transfer to keychain instead of zsh" of course...
Comment 8 Mathieu Chouquet-Stringer 2008-09-25 07:15:47 EDT
Closed (new bug is 463913).

Note You need to log in before you can comment on or make changes to this bug.