Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

RE: new bash?

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Tools Discussion Forum >> RE: new bash? Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
RE: new bash? - Oct. 26, '04, 3:52:48 PM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
quote:

> And while I'm asking, how did you fix the problem with getcwd?
I didn't run into the problem (luck of the Irish I guess).

Seems like I have to change nationality:
[code]shell-init: error retrieving current directory: getcwd: cannot access parent dir
ectories: Bad file descriptor
job-working-directory: error retrieving current directory: getcwd: cannot access
parent directories: Undefined error: 0
job-working-directory: error retrieving current directory: getcwd: cannot access
parent directories: Undefined error: 0
chdir: error retrieving current directory: getcwd: cannot access parent director
ies: Undefined error: 0
Welcome to the Interix UNIX utilities.

jonsmi@ayla:~> bash --version
GNU bash, version 3.00.0(10)-release (i586-pc-interix3)
Copyright (C) 2004 Free Software Foundation, Inc.
jonsmi@ayla:~> sux
Password:
shell-init: error retrieving current directory: getcwd: cannot access parent dir
ectories: Bad file descriptor
job-working-directory: error retrieving current directory: getcwd: cannot access
parent directories: Undefined error: 0
job-working-directory: error retrieving current directory: getcwd: cannot access
parent directories: Undefined error: 0
chdir: error retrieving current directory: getcwd: cannot access parent director
ies: Undefined error: 0
Welcome to the Interix UNIX utilities.

ayla:~#
Started from C:\WINDOWS\system32\POSIX.EXE /u /c /usr/local/bin/bash -l.
sux i shorthand for domain admin.

(in reply to Rodney)
Post #: 21
RE: new bash? - Oct. 26, '04, 6:59:19 PM   
jonsmi

 

Posts: 168
Joined: Aug. 12, '03,
From: Oslo, Norway
Status: offline
Have by now tested this on four machines, on XP/SP2, the rest Windows 2003 Server.
Everything is set to American English, except keyboard and time zone (Norwegian).

The error remains the same. That is if you launch bash from withing the C Shell, you
won't notice it.

To make sure nothing was left over from former releases, on one machine I removed
bash completely this way from inside the C Shell:
% pkg_info | grep bash
bash-2.05.2.2-bin  Version 2.05.2.2 of bash for Interix 3.5.
% pkg_delete bash-2.05.2.2-bin
% /usr/local/libexec/locate.updatedb
% locate bash

Until only this was left:
% /usr/local/libexec/locate.updatedb
% locate bash
/etc/bashrc
/usr/local/share/emacs/21.2/etc/emacs.bash
%

Then I installed bash 3.0 with
pkg_add ftp://ftp.interopsystems.com/pkgs/3.5/bash-current-bin.tgz

Still the same error with shell-init/error getcwd.

There is another issue as well, when updating bash from within bash:
DISPLAY=localhost:0.0
felicia:~# pkg_add ftp://ftp.interopsystems.com/pkgs/3.5/bash-current-bin.tgz
pkg_add(bash-current-bin): other version 'bash-2.05.2.2-bin' already installed
pkg_add(bash-current-bin): proceeding to install newer version
pkg_add(bash-current-bin): proceeding to uninstall older version first
pkg_delete(bash-2.05.2.2-bin): couldn't entirely delete package (perhaps the pac
king list is incorrectly specified?)
felicia:~#

On Linux this does not happen, but perhaps it does on other UNIX flavors, and
certainly with a lot of Windows apps.

Nothing of this meant as any sort of criticism, but as some observations, which
perhaps might help to track down where the fault may lie.

Just a thought: bash 3.0 i a major update. A conservative Linux distribution
like SUSE 9.1, which is quite concerned about QA, lies on increment behind with its
bash 2.x. I could be that bash 3.0 all in all still has its teething troubles on
all platforms, and that Interop Systems should offer both versions.

(in reply to jonsmi)
Post #: 22
RE: new bash? - Oct. 26, '04, 8:32:10 PM   
magus1011

 

Posts: 15
Status: offline
I'm running WinBlows 2000 SP4 and having exactly the same problems as jonsmi including the update problem.

Put bash-2.05.2.2-bin back please , pretty please cream and sugar?

--
Best Regards,
 Magus1011

(in reply to jonsmi)
Post #: 23
RE: new bash? - Oct. 26, '04, 11:09:59 PM   
breiter

 

Posts: 346
Joined: Jun. 14, '04,
From: Washington, DC
Status: offline
This is interesting from the NOTES of BASH 3.0:
quote:


4. Building on Interix (nee OpenNT), which Microsoft bought from Softway
Systems and has seemingly abandoned (thanks to Kevin Moore for this item).

1. cp cross-build/opennt.cache config.cache

2. If desired, edit pathnames.h to set the values of SYS_PROFILE and
DEFAULT_HOSTS_FILE appropriately.

3. export CONFIG_SHELL=$INTERIX_ROOT/bin/sh

4. ./configure --prefix=$INTERIX_ROOT/usr/local (or wherever you
want it).

5. make; make install; enjoy

Abandoned? They must not realize that Services for UNIX and Interix have been merged.

Anyway, these instructions do nada to fix the problem with getcwd during shell-init with POSIX.exe

(in reply to magus1011)
Post #: 24
RE: new bash? - Oct. 26, '04, 11:19:37 PM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
You can still get bash 2.05.2.2 from the ftp site.
All "old" versions are archived in ftp://ftp.interopsystems/pkgs/3.5-prev

To roll-back you need to delete the version that is on your machine with pkg_delete.
Then do "pkg_add ftp://ftp.interopsystems.com/pkgs/3.5-prev/bash-2.05.2.2"

I'll note that the message "couldn't entirely delete package..." can be ignored. The
complaint is that the binary (bash) is in use. When the next version starts to be added
the older version is renamed to place it out of the way. After that you need to restart
any bash shells to pick up the new version. I'll have to look at some point in
time to making that into a more specific message. I have planned some work on pkg
later this week.

So the question, now, is why does the getcwd() message show up for several people?
Because Brian had experienced the problem I did try it on two different machines
without a problem. I've tried this from a cmd.exe shell (Win32 world) and from
various other shells (ksh, csh, zsh) invoked with POSIX.EXE and just direct.
I tried it from a shortcut too. So either I have/haven't something on my machines
that other haven't/have on theirs. I'll make a debug version that traces all getcwd
usage and see what comes of that for clues.

(in reply to magus1011)
Post #: 25
RE: new bash? - Oct. 26, '04, 11:22:52 PM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
> Anyway, these instructions do nada to fix the problem with getcwd during shell-init with POSIX.exe

Yeah. To be sure when I built bash I did a "-U__OPENNT" and converted to __INTERIX in
the source what can still validly be used. That's also why I made an "interix3" in configure.

(in reply to Rodney)
Post #: 26
RE: new bash? - Oct. 26, '04, 11:32:07 PM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
Here's a question for people experiencing the problem with getcwd():
What is your home directory set to in the user database ? (the home that finger gives).

Also, do you get the getcwd() problem when you start bash via POSIX.EXE without
using the "-l" (dash-ell) option?
POSIX /u /c /usr/local/bin/bash

< Message edited by Rodney -- Oct. 26, '04, 11:38:04 PM >

(in reply to Rodney)
Post #: 27
RE: new bash? - Oct. 26, '04, 11:35:06 PM   
breiter

 

Posts: 346
Joined: Jun. 14, '04,
From: Washington, DC
Status: offline
OK. I may have some more info here.

I have a cmd script that is a clone of ksh.bat that is in my path.

[breiter@johngalt]# cat /dev/fs/C/Program\ Files/Util/bash.cmd
:: a bat script to invoke a SFU/Interix login bash
:: from MS Windows environment (ie cmd.exe )
:: This assumes the Interix subsystem and Interix utilities
:: have been installed
::
::
:: Rcsid = $Id$
::
@echo off
title Bourne Again Shell
posix /u /c /usr/local/bin/bash %1 %2 %3 %4 %5 %6 %7 %8 %9
title Command Prompt

Start | Run | bash -l works. Starting bash from any running POSIX shell (sh/ksh,csh,tcsh, even bash) works without error.. Starting bash from any sort of shortcut doesn't work: I get the slew of getcwd errors.

Here's another tidbit, starting bash from a CMD shell without the -l switch generates an error, but just one:

shell-init: error retrieving current directory: getcwd: cannot access parent dir
ectories: No such file or directory

< Message edited by breiter -- Oct. 26, '04, 11:38:07 PM >

(in reply to Rodney)
Post #: 28
RE: new bash? - Oct. 26, '04, 11:37:06 PM   
breiter

 

Posts: 346
Joined: Jun. 14, '04,
From: Washington, DC
Status: offline
[breiter@johngalt]# finger breiter
Login: breiter Name: Brian A. Reiter
Directory: /dev/fs/C/Documents and Settings/breiter Shell: /usr/local/bin/tc
sh
On since Tue Oct 26 23:23 on ttyn00 from localhost
No Mail.
No Plan.

(in reply to Rodney)
Post #: 29
RE: new bash? - Oct. 26, '04, 11:44:05 PM   
breiter

 

Posts: 346
Joined: Jun. 14, '04,
From: Washington, DC
Status: offline
Oh yeah. It works just fine from a running CMD shell, too.
cmd> posix /u /c /usr/local/bin/bash -l
Welcome to johngalt.wolfereiter.priv, Brian.

bash-3.00$

It's just a .lnk shortcut that causes the problem. I don't know what is different about a shortcut.

< Message edited by breiter -- Oct. 26, '04, 11:50:05 PM >

(in reply to breiter)
Post #: 30
RE: new bash? - Oct. 26, '04, 11:57:35 PM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
I now have the problem repeating for me. I now just have to figure out
what I "broke" to make it happen (turning the screen lime green seemed to help
but I doubt it's the cause )

(in reply to breiter)
Post #: 31
RE: new bash? - Oct. 27, '04, 12:12:04 AM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
All right I found the problem.
It has absolutely nothing to do with getcwd(). The call is never made.
What is failing is an open() and some dumb-ass (yes, that's the technical term)
prints out the wrong error message. SO we've been chasing a red herring.

The failure is the opening of a locale file. I hit on it by doing this in
Japanese. To whit, here's the trace from truss:
open("/usr/local/share/locale/locale.alias", 0x1) open failed: errno 2, No such
file or directory

open("/usr/local/share/locale/win-ja_JP.windows-932/LC_MESSAGES/bash.mo", 0x1)
open failed: errno 2, No such file or directory

open("/usr/local/share/locale/win-ja_JP.windows932/LC_MESSAGES/bash.mo", 0x1)
open failed: errno 2, No such file or directory

open("/usr/local/share/locale/win-ja_JP/LC_MESSAGES/bash.mo", 0x1) open failed:
errno 2, No such file or directory

open("/usr/local/share/locale/win-ja.windows-932/LC_MESSAGES/bash.mo", 0x1) open
 failed: errno 2, No such file or directory

open("/usr/local/share/locale/win-ja.windows932/LC_MESSAGES/bash.mo", 0x1) open
failed: errno 2, No such file or directory

open("/usr/local/share/locale/win-ja/LC_MESSAGES/bash.mo", 0x1) open failed:
errno 2, No such file or directory

write(2, 0x20A888, 116) shell-init: error retrieving current directory: getcwd:
cannot access parent directories: No such file or directory


This is new code in bash. And, no, the build of bash doesn't
seem to generate these files. I'll dig into the code now.

(in reply to Rodney)
Post #: 32
RE: new bash? - Oct. 27, '04, 12:50:06 AM   
breiter

 

Posts: 346
Joined: Jun. 14, '04,
From: Washington, DC
Status: offline
Strike that last thing. Obviosly if found libc or it wouldn't have gotten very far. Anyway, it looks like it found my local info /usr/share/locale/_ASCII.

Check this out:
open("/dev/tty", 0x1003) open returned 3
close(3) close returned 0
open("/usr/share/locale//_ASCII", 0x1) open returned 3
read(3, 0x1246B8, 131072) read returned 131072 0x20000
close(3) close returned 0
open("/usr/share/locale//ASCII_", 0x1) open returned 3

...

write(2, 0x144930, 110) shell-init: error retrieving current directory: getcwd:
cannot access parent directories: Bad file descriptor
write returned 110 0x6E
getids() getids returned 0
getids() getids returned 0
getids() getids returned 0
dup() dup returned 3
getrlimit() getrlimit returned 0
fcntl(255, 0x1, 0x0) fcntl failed: errno 9, Bad file descriptor

...

read(3, 0x89F930, 128) job-working-directory: error retrieving current directory
: getcwd: cannot access parent directories: Undefined error: 0
read returned 27 0x1B
read(3, 0x89F930, 128) read returned 0
signal 18 SIGCHLD code=1
waitpid(-1, , 0x1) waitpid returned pid=1821 status=0x0
waitpid(-1, , 0x1) waitpid failed: errno 10, No child processes

...

igprocmask() sigprocmask returned 0
close(3) close returned 0
sigprocmask() sigprocmask returned 0
sigaction() sigaction returned 0
sigprocmask() sigprocmask returned 0
sigaction() sigaction returned 0
sigprocmask() sigprocmask returned 0
sigprocmask() sigprocmask returned 0
sigprocmask() sigprocmask returned 0
sigprocmask() sigprocmask returned 0
sigprocmask() sigprocmask returned 0
sigprocmask() sigprocmask returned 0
sigprocmask() sigprocmask returned 0
pipe() pipe returned 0
sigprocmask() sigprocmask returned 0
fork() fork returned 1679 0x68F
sigprocmask() sigprocmask returned 0
sigaction() sigaction returned 0
close(4) close returned 0
read(3, 0x89F930, 128) job-working-directory: error retrieving current directory
: getcwd: cannot access parent directories: Undefined error: 0
read returned 21 0x15
read(3, 0x89F930, 128) read returned 0
signal 18 SIGCHLD code=1
waitpid(-1, , 0x1) waitpid returned pid=1679 status=0x0
waitpid(-1, , 0x1) waitpid failed: errno 10, No child processes


(in reply to Rodney)
Post #: 33
RE: new bash? - Oct. 27, '04, 1:09:03 AM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
A major problem is that one error message is coming out for more than one error.
And many of these error returns just don't warrant a message to the user. The
"error" can be expected and handled without a problem for the user.

(in reply to breiter)
Post #: 34
RE: new bash? - Oct. 27, '04, 8:27:57 AM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
The times bash is being successful is when the env var PWD is set.
Looking at the source code for bash shows the function get_working_directory()
calling getcwd as: "getcwd(0, 0)". This is an 'ouch' as the man page says:
The getcwd(2) function will fail if:
[EINVAL] The size argument is zero.

But even when I fix the getcwd() call to have proper args, it still fails (returns NULL)
but errno does not get set. I test this by forcing errno to == 0 just before the call.
The errno message we were getting before was left over from the open() or read() calls
failing, but getting handled. So this was confusing the matter (or at least me).

I walked the code (with no PWD) and I see getcwd() called, but the system doesn't see it.
So the function getcwd() is an internal bash function -- not the system function.
The config.h file is not being paid attention to (I don't know why yet) that getcwd()
is available; the config.h file has it correct.

When I hack the lib/sh/getpwd.c file to get rid of it, then things work fine.
In lib/sh there are a bunch of other functions that I have to wonder if they
are being built when they shouldn't be.

In the meantime, I'll be posting a new bash package with the fix.
This gives a 3.0 for people now that's working. I've looked at the other
parts of the same bash lib and getenv, setenv & putenv are built when they
don't need to be. But these 3 don't seem to cause the harm that the getcwd did.

(in reply to Rodney)
Post #: 35
RE: new bash? - Oct. 27, '04, 5:41:37 PM   
breiter

 

Posts: 346
Joined: Jun. 14, '04,
From: Washington, DC
Status: offline
quote:

When I hack the lib/sh/getpwd.c file to get rid of it, then things work fine.

I don't understand. lib/sh/getpwd.c is identical in bash-2.05b and bash-3.00 source with the exception of 3 lines of code that are added in bash-3.00 but only conditionally compile on AIX. Are you saying that you just added a line like "#define HAVE_GETCWD 1" to the top of lib/sh/getpwd.c? I don't get it, #define HAVE_GETCWD 1 is defined in config.h after I run ./configure.

quote:

calling getcwd as: "getcwd(0, 0)". This is an 'ouch'

You're talking about builtins/common.c, right? I looked at that, too, because the function changed pretty radically from bash-2.05b. Did you do something like below, because I thought I tried that and it didn't seem to make any difference.

builtins/common.c line ~467
change
  if (no_symbolic_links)
    {
      FREE (the_current_working_directory);
      the_current_working_directory = (char *)NULL;
    }

  if (the_current_working_directory == 0)
    {
      the_current_working_directory = getcwd (0, 0);
      if (the_current_working_directory == 0)
        {
          fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
                   (for_whom && *for_whom) ? for_whom : get_name_for_error (),
                   _(bash_getcwd_errstr), strerror (errno));
          return (char *)NULL;
        }
    }

to something more like this
  if (no_symbolic_links)
    {
      if (the_current_working_directory)
        FREE (the_current_working_directory);

      the_current_working_directory = (char *)NULL;
    }

  if (the_current_working_directory == 0)
    {
      the_current_working_directory = (char *)xmalloc (PATH_MAX);
      the_current_working_directory[0] = '\0';
      directory = getcwd (the_current_working_directory, PATH_MAX);
      if (directory == 0)
        {
          fprintf (stderr, _("%s: error retrieving current directory: %s: %s\n"),
                   (for_whom && *for_whom) ? for_whom : get_name_for_error (),
                   bash_getcwd_errstr, strerror (errno));

          FREE (the_current_working_directory);
          the_current_working_directory = (char *)NULL;
          return (char *)NULL;
        }
    }


Oh, now I see, argh!! You have to do BOTH of those things at once: #define HAVE_GETCWD 1 in getcwd.c and hack common.c.

And... viola it works.

Hmm. That is totally, uh... What's the right word? *@#(%&!@#%^!

< Message edited by breiter -- Oct. 27, '04, 5:42:46 PM >

(in reply to Rodney)
Post #: 36
RE: new bash? - Oct. 27, '04, 6:08:27 PM   
minameismud

 

Posts: 14
Joined: Jul. 13, '04,
Status: offline
just noticed the new bash today. (rodney, you da man with the packages...i'm definitely donating some moola)

anywho, i saw the "libintl.so" error on page 1 and read the rest of the posts...but this question still exists: how do i fix the problem without hacking bash source files?

(in reply to breiter)
Post #: 37
RE: new bash? - Oct. 27, '04, 7:24:39 PM   
Rodney

 

Posts: 3729
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
> Hmm. That is totally, uh... What's the right word? *@#(%&!@#%^!

Sounds about right.
I left figuring out the "why" to get rman and tkman out since the
resulting end binary will look the same. As you note, no obvious change from 2.05
to 3.0 for this in config.h, etc. Something is odd happening. We'll figure it out
at some point (likely in one of the other header files).

> just noticed the new bash today. (rodney, you da man with the packages...i'm definitely donating some moola)

Thank you We appreciate it.

> anywho, i saw the "libintl.so" error on page 1 and read the rest of the posts...

The 3.0.0.1 package should be working (the binary). The discussion in this thread has been
around what people have been building personally and then the 3.0 binary release.
So the "libintl.so" is clear now AFAIK.

In a different thread, ("Current bash issue?") RW is experiencing a problem with
libiconv.so. But I think this is a separate problem given he has libiconv installed.

(in reply to minameismud)
Post #: 38
RE: new bash? - Oct. 27, '04, 11:59:18 PM   
magus1011

 

Posts: 15
Status: offline
I'm running Win 2KP SP4. My finger and pwd are as follows:
==========
Welcome to the Interix UNIX utilities.

DISPLAY=localhost:0.0
bash-3.00$ finger root
finger: root: no such user.
bash-3.00$ finger administrator
Login: Administrator Name: Built-in account for administering the computer/domain
Directory: /dev/fs/K/SFU/home/root Shell: /usr/local/bin/bash
On since Wed Oct 27 22:41 on ttyn00, idle 2 days 19:17, from localhost
No Mail.
No Plan.
bash-3.00$ pwd
/dev/fs/K/SFU/home/root
bash-3.00$
==========
I think the new bash (3.0.0.1) is working for me.

_Thank_You_Rodney_!!!

--
Best Regards,
 Magus 1011

(in reply to Rodney)
Post #: 39
Page:   <<   < prev  1 [2]
All Forums >> [SFU / Interix / SUA Technology] >> Tools Discussion Forum >> RE: new bash? Page: <<   < prev  1 [2]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.078