Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 688856

Summary: pwd returns //
Product: Red Hat Enterprise Linux 6 Reporter: Lubos Kocman <lkocman>
Component: bashAssignee: Roman Rakus <rrakus>
Status: CLOSED NOTABUG QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: low Docs Contact:
Priority: low    
Version: 6.1CC: meyering, ovasik, prc, tsmetana
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-22 11:39:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lubos Kocman 2011-03-18 09:22:42 UTC
Description of problem:

bash-4.1$ export PS1="[\u@\h \W]$"
[lkocman@dhcp-28-248 Desktop]$cd //
[lkocman@dhcp-28-248 //]$pwd
//
[lkocman@dhcp-28-248 //]$ls
bin   cgroup  etc   lib    lost+found  misc  net  proc  sbin     srv  tmp  var
boot  dev     home  lib64  media       mnt   opt  root  selinux  sys  usr
[lkocman@dhcp-28-248 //]$rpm -qf `which pwd`
coreutils-8.4-12.el6.x86_64

[lkocman@dhcp-28-248 //]$


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

bash-4.1.2-8.el6.x86_64
coreutils-8.4-12.el6.x86_64

How reproducible:


Steps to Reproduce:
1. export PS1="[\u@\h \W]$"
2. cd //
3. pwd
  
Actual results:

// (is this really wanted behaviour?)

Expected results:

/ 

Additional info:

Comment 1 Lubos Kocman 2011-03-18 09:24:56 UTC
cd /// and more returns /

Comment 2 Jim Meyering 2011-03-18 09:29:50 UTC
This does not involve coreutils, but rather bash's built-in pwd:

  $ bash -c 'cd //; env pwd'
  /

  $ bash -c 'cd //; pwd'
  //

I've changed the component from coreutils to bash.

Comment 5 Roman Rakus 2011-03-18 12:23:03 UTC
(In reply to comment #0)
> Description of problem:
> 
> bash-4.1$ export PS1="[\u@\h \W]$"
> [lkocman@dhcp-28-248 Desktop]$cd //
> [lkocman@dhcp-28-248 //]$pwd
> //
> [lkocman@dhcp-28-248 //]$ls
> bin   cgroup  etc   lib    lost+found  misc  net  proc  sbin     srv  tmp  var
> boot  dev     home  lib64  media       mnt   opt  root  selinux  sys  usr
> [lkocman@dhcp-28-248 //]$rpm -qf `which pwd`
> coreutils-8.4-12.el6.x86_64
> 
> [lkocman@dhcp-28-248 //]$
> 
> 
> Version-Release number of selected component (if applicable):
> 
> bash-4.1.2-8.el6.x86_64
> coreutils-8.4-12.el6.x86_64
> 
> How reproducible:
> 
> 
> Steps to Reproduce:
> 1. export PS1="[\u@\h \W]$"
> 2. cd //
> 3. pwd
> 
> Actual results:
> 
> // (is this really wanted behaviour?)
Yes it is.
> 
> Expected results:
> 
> / 
> 
> Additional info:

See http://www.faqs.org/faqs/unix-faq/shell/bash/ E10

Comment 7 Lubos Kocman 2011-03-22 10:00:22 UTC
bash-4.1$ cd //
bash-4.1$ /bin/pwd 
/
bash-4.1$ pwd
//


Problem is bash.

Comment 8 Ondrej Vasik 2011-03-22 11:26:38 UTC
Have you read the faq Roman posted in comment #10 ?

Cite:
"
E10) Why does `cd //' leave $PWD as `//'?

POSIX.2, in its description of `cd', says that *three* or more leading
slashes may be replaced with a single slash when canonicalizing the
current working directory.

This is, I presume, for historical compatibility.  Certain versions of
Unix, and early network file systems, used paths of the form
//hostname/path to access `path' on server `hostname'.
"

So the bash behaviour seems to be really intentional. I'll leave it up on you or Roman to close it again notabug .