Author Topic: problems with sh.exe  (Read 9394 times)

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
problems with sh.exe
« on: June 11, 2017, 10:13:43 pm »
I've successfully installed PostgreSQL in the past.
One has to use initdb.exe and the various executables to create databases, add tables, data and functions etc.
I decided to try once more, but now stumble on messages that sh.exe can't do this and that.
I've tried to rename ash, bash, dash to sh but the problem remain.
What has been changed and why? Fix?

Issue #164
initdb.exe from PostgreSQL apparently use sh.exe internally to initialize a new database structure.

Command line: initdb -E UTF8 -D D:/NLSTeam
Has worked in the past, but not now with installed libraries up to date according to ANPM.

Version: PostgreSQL 8.2.5 b2
Output:
sh.exe: 1: cannot create nul:: Directory nonexistent
fgets failure: No such file or directory
The program "postgres" is needed by initdb but was not found in the
same directory as "D:/Programs/postgres/bin/initdb".
Check your installation.
Couldn't initalize database

Version: PostgreSQL 9.1.7
Output:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale sv_SE.IBM-850.
could not determine encoding for locale "sv_SE.IBM-850": codeset is "IBM-850"
could not determine encoding for locale "sv_SE.IBM-850": codeset is "IBM-850"
The default text search configuration will be set to "swedish".

creating directory D:/NLSTeam ... ok
creating subdirectories ... ok
selecting default max_connections ... sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
10
selecting default shared_buffers ... sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
sh.exe: 1: cannot open nul:: No such file
sh.exe: 1: D:Programspgsqlbinpostgres.exe: not found
400kB
creating configuration files ... ok
creating template1 database in D:/NLSTeam/base/1 ... sh.exe: 1: D:Programspgsqlb
inpostgres.exe: not found
child process exited with exit code 127
initdb: removing data directory "D:/NLSTeam"
SYS1808:
The process has stopped. The software diagnostic
code (exception code) is 0005.
Couldn't initalize database

ak120

  • Guest
Re: problems with sh.exe
« Reply #1 on: June 11, 2017, 11:03:21 pm »
I've successfully installed PostgreSQL in the past.
One has to use initdb.exe and the various executables to create databases, add tables, data and functions etc.
I decided to try once more, but now stumble on messages that sh.exe can't do this and that.
I've tried to rename ash, bash, dash to sh but the problem remain.
What has been changed and why? Fix?
Better don't ask. All this stuff behaves like crap when installed via RPM. I would recommend to use simply Korn Shell or pdksh (http://hobbes.nmsu.edu/download/pub/os2/util/shell/pdksh-5.2.14-bin-7.zip). It seems the packagers of the RPM stuff have no clue about how a shell works under UNIX, so don't expect that it will work under OS/2.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: problems with sh.exe
« Reply #2 on: June 12, 2017, 01:19:14 am »
I second Andreas's comment, use the latest libc version of pdksh or mksh. Unluckily probably have to keep the rpm installed sh around for rpm/yum to work properly. Perhaps install in /bin or /usr/local/bin and put at front of PATH.

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1024
  • Karma: +24/-0
    • View Profile
    • Blonde Guy
Re: problems with sh.exe
« Reply #3 on: June 13, 2017, 02:17:55 am »
I'm seeing sh as the reason I can't build PMMail anymore. This is GCC 335, and I suppose I could try to adapt the makefile.  sh never seems to understand the backslash. I don't know how g++ is even finding sh.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: problems with sh.exe
« Reply #4 on: June 13, 2017, 02:37:18 am »
What's your makeshell set to? Is the PMMail makefile written for sh or cmd.exe? You could try
Code: [Select]
set MAKESHELL=cmd.exe

ak120

  • Guest
Re: problems with sh.exe
« Reply #5 on: June 13, 2017, 10:20:32 am »
What's your makeshell set to? Is the PMMail makefile written for sh or cmd.exe? You could try
Code: [Select]
set MAKESHELL=cmd.exe

Additionally the setting of environment variable EMXSHELL seems to be preferred by some tools.

Greg Pringle

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
    • View Profile
Re: problems with sh.exe
« Reply #6 on: June 15, 2017, 11:37:29 pm »
Where did the Postgres 9.1.7 come from. Is it a Paul Smedley port? He is not currently listing that one.

Greg Pringle

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
    • View Profile
Re: problems with sh.exe
« Reply #7 on: June 16, 2017, 01:54:46 pm »
I should have checked first. I have the Paul Smedley port postgresql-9.1.7-os2-201201212.zip
I will install it with ArcaOS and report my findings.

Silvan Scherrer

  • Full Member
  • ***
  • Posts: 200
  • Karma: +1/-0
    • View Profile
Re: problems with sh.exe
« Reply #8 on: June 16, 2017, 02:18:55 pm »
I've successfully installed PostgreSQL in the past.
One has to use initdb.exe and the various executables to create databases, add tables, data and functions etc.
I decided to try once more, but now stumble on messages that sh.exe can't do this and that.
I've tried to rename ash, bash, dash to sh but the problem remain.
What has been changed and why? Fix?

Please have a look at issue #164. I gave there some hints.

And this issue has completely nothing to do with sh. Sh behaves exactly as it should. When a app or a script using sh doesn't escape \ right it can't work of course. The reason (most likely) that it now came up, is the SET SHELL setting in config.sys. This setting is for most parts ok, but might break some old ports. In this case just unset the setting on a cmdline and start the installation again. This should work.

regards
Silvan
kind regards
Silvan
CTO bww bitwise works GmbH

Please help us with donations, so we can further work on OS/2 based projects. Our Shop is at https://www.bitwiseworks.com/shop/index.php

Greg Pringle

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
    • View Profile
Re: problems with sh.exe
« Reply #9 on: June 16, 2017, 03:55:58 pm »
I unset SHELL and it makes no difference.

Paul sent me the source for 9.1.3  which I spent some time with. It looks like path.c might be destroying the path.
Not able to correctly retain the directory slashes. I don't have the time for full debugging.
Clearly a change was made to the paths in the current ArcaOS.

Silvan Scherrer

  • Full Member
  • ***
  • Posts: 200
  • Karma: +1/-0
    • View Profile
Re: problems with sh.exe
« Reply #10 on: June 16, 2017, 05:14:37 pm »
I unset SHELL and it makes no difference.

Paul sent me the source for 9.1.3  which I spent some time with. It looks like path.c might be destroying the path.
Not able to correctly retain the directory slashes. I don't have the time for full debugging.
Clearly a change was made to the paths in the current ArcaOS.

There are more SHELL settings in config.sys. Try to unset all or try to set them all to cmd.exe for a test.
Im more than sure one of those is guilty.

regards
Silvan
kind regards
Silvan
CTO bww bitwise works GmbH

Please help us with donations, so we can further work on OS/2 based projects. Our Shop is at https://www.bitwiseworks.com/shop/index.php

Greg Pringle

  • Full Member
  • ***
  • Posts: 148
  • Karma: +0/-0
    • View Profile
Re: problems with sh.exe
« Reply #11 on: June 16, 2017, 06:15:07 pm »
OK
The trick is to unset two variables.
This also needs to be done to run PostgreSQL
Here is what I did:
/* setup of Eforward Server with Postgres 9.1.7 */
/* uses postgresql-9.1.7-os2-201201212.zip from Paul Smedley */
/* uses jdbc driver postgresql-9.3-1103.jdbc3.jar */

K:
cd \
mkdir pgdb917
copy postgresql-9.1.7-os2-201201212.zip K:\pgdb917
cd \pgdb917
unzip postgresql-9.1.7-os2-201201212.zip

mkdir \pgdb917\pgsql\java
copy postgresql-9.3-1103.jdbc3.jar K:\pgdb917\pgsql\java\postgres.jar

SET SHELL=
SET EMXSHELL=

cd \pgdb917\pgsql\bin

initdb -D K:\pgdb917\data -E LATIN1

output---------------

Success. You can now start the database server using:

    "postgres" -D "k:/pgdb917/data"
or
    "pg_ctl" -D "K:/pgdb917/data" -l logfile start

======================================================
--------------------

create file K:\pgdb917\pgsql\bin\startdb.cmd with these lines:
SET SHELL=
SET EMXSHELL=

pg_ctl -D K:\pgdb917\data start

create file K:\pgdb917\pgsql\bin\stopdb.cmd with this line:
pg_ctl -D K:\pgdb917\data stop -m smart

run startdb.cmd

run stopdb.cmd

# This shows the database is created and can be started and stopped.

run: startdb.cmd

run: psql template1 postgres
from prompt:
\h create user              # this lists the usage
create user cvd with password 'secret' CREATEDB CREATEUSER CREATEROLE;
\du                         # show the users
\q                          # exit command interface
psql template1 cvd          # restart the command interface
create database eforward;
\c eforward
create schema eforward;
\q

There is some configuration needed but it is running.

this can be done to conserve memory:
highmem -c postgres.dll
cd ..\lib
highmem -c *.dll
« Last Edit: June 16, 2017, 06:55:17 pm by Greg Pringle »