bugGNU Octave - Bugs: bug #54031, [octave forge] (database) Unit...

 
 

bug #54031: [octave forge] (database) Unit test in pq_connect.m segfaults for local database

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Fri 01 Jun 2018 01:42:56 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 29 Jun 2018 02:55:43 PM UTC, comment #4: 

Fixed by this changeset:

https://sourceforge.net/p/octave/database/ci/71aee894c29ce00e1f75e8d7d41919c45cfc8afa/

, which removes determination of the superuser OID and reads base types without it.

Olaf Till <i7tiol>
Group Member
Thu 28 Jun 2018 02:51:36 PM UTC, comment #3: 

The segfault has been turned into an error by this changeset:

https://sourceforge.net/p/octave/database/ci/3d2a333bc3350d5ba528b6f41fab4aaefed7172f/

, but the problem in making it work is that for reliably reading the base types, the OID of "server user" is needed. This OID is read by the package by trusting that this user is named "postgres", while with the current configuration it is the name of the user who runs the test. Maybe it's necessary to deduce the correct name from servers system tables somehow. OTOH, maybe the OID is always 10. Does someone of you know if I can rely on it being 10?

Olaf Till <i7tiol>
Group Member
Wed 27 Jun 2018 08:21:32 PM UTC, comment #2: 

Confirmed with postgresql 9.6.7. Still have to examine.

Olaf Till <i7tiol>
Group Member
Fri 01 Jun 2018 08:49:59 PM UTC, comment #1: 

Same on cygwin 64

 Octave 4.4, database 2.4.3, and PostGreSQL 10.4

  database-2.4.3/pq_connect.m .................................fatal: caught signal Segmentation fault -- stopping myself...

and I am the admin

marco atzeri <matzeri>
Fri 01 Jun 2018 01:42:56 PM UTC, original submission:  

I am trying to run the unit test in pq_connect.m against a PostGreSQL database created locally, i.e. without root access.  It is segfaulting and I cannot figure out what is wrong.  Below is the transcript of my session in bash.  I am also attaching to this bug report the result of strace for the last octave-cli command below. I am using Octave 4.4, database 2.4.3, and PostGreSQL 10.

Please, tell me if I should do something else in order to test pq_connect without root access.  Also, feel free to close this report if this is a non-bug.


$ export PGDIR=$HOME/pg
$ export PGHOST=/tmp
$ export PGPORT=5433
$ rm -rf $PGDIR
$ mkdir $PGDIR
$ /usr/lib/postgresql/10/bin/initdb -D $PGDIR -U $USER
The files belonging to this database system will be owned by user "rlaboiss".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/rlaboiss/pg ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/lib/postgresql/10/bin/pg_ctl -D /home/rlaboiss/pg -l logfile start

$ /usr/lib/postgresql/10/bin/pg_ctl -D $PGDIR -o "-c unix_socket_directories=$PGHOST" -w start
waiting for server to start....2018-06-01 10:31:52.801 -03 [11701] LOG:  listening on IPv6 address "::1", port 5433
2018-06-01 10:31:52.802 -03 [11701] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2018-06-01 10:31:52.880 -03 [11701] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5433"
2018-06-01 10:31:52.912 -03 [11702] LOG:  database system was shut down at 2018-06-01 10:31:36 -03
2018-06-01 10:31:52.920 -03 [11701] LOG:  database system is ready to accept connections
 done
server started
$ echo "create database test with owner = $USER;" | psql template1
CREATE DATABASE
$ echo 'pkg load database; setenv ("PGHOST", "/tmp"); setenv ("PGPORT", "5433"); test pq_connect' | octave-cli -q
fatal: caught signal Segmentation fault -- stopping myself...
Segmentation fault


Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by i7tiol (Posted a comment)
  • -email is unavailable- added by matzeri (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-06-29 i7tiol StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2018-06-27 i7tiol StatusNone Confirmed
    2018-06-01 rlaboiss Attached File- Added database-test-pq_connect-strace.txt, #44270

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code