Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pgmodeler-cli 0.9.4-alpha export to file encounters segmentation fault #1587

Open
garetht opened this issue Sep 16, 2021 · 1 comment
Open

Comments

@garetht
Copy link

garetht commented Sep 16, 2021

Bug description
When attempting to use the --export-to-file command in pgloader-cli, a segmentation fault is encountered. This happens on 0.9.4-alpha and not 0.9.3.

How to reproduce
Please, if the bug can be reproduceable describe the steps in full details. If possible provide a sample model and/or a SQL dump for test purposes.

  1. Create a directory with a models folder containing plain.dbm, which was made by creating a new empty project and saving it immediately.
<?xml version="1.0" encoding="UTF-8"?>
<!--
CAUTION: Do not modify this file unless you know what you are doing.
         Unexpected results may occur if the code is changed deliberately.
-->
<dbmodel pgmodeler-ver="0.9.4-alpha" use-changelog="false" last-position="0,0" last-zoom="1" max-obj-count="4"
	 default-schema="public" default-owner="postgres"
	 layers="Default layer"
	 active-layers="0"
	 layer-name-colors="#000000"
	 layer-rect-colors="#b4b4b4"
	 show-layer-names="false" show-layer-rects="false">
<database name="new_database" is-template="false" allow-conns="true">
</database>

<schema name="public" layers="0" fill-color="#e1e1e1" sql-disabled="true">
</schema>

</dbmodel>

2 Run docker run -v $(pwd)/models:/models -it --entrypoint /bin/bash apazga/docker-pgmodeler:0.9.4-alpha.
3. From within the Docker container, run pgmodeler-cli -platform offscreen --export-to-file --input /models/plain.dbm --output plain.sql

The following output is produced:

pgModeler 0.9.4-alpha command line interface.
Starting model export...
Loading input file: /models/plain.dbm
Segmentation fault

Expected behavior
The file should be exported to SQL.

Note that this does not occur in pgmodeler 0.9.3 with a similar empty file:

plain93.dbm

<?xml version="1.0" encoding="UTF-8"?>
<!--
CAUTION: Do not modify this file unless you know what you are doing.
         Unexpected results may occur if the code is changed deliberately.
-->
<dbmodel pgmodeler-ver="0.9.3" use-changelog="false" last-position="0,0" last-zoom="1" max-obj-count="4"
	 default-schema="public" default-owner="postgres">
<database name="new_database" is-template="false" allow-conns="true">
</database>

<schema name="public" layer="0" fill-color="#e1e1e1" sql-disabled="true">
</schema>

After running docker run -v $(pwd)/models:/models -it --entrypoint /bin/bash apazga/docker-pgmodeler:0.9.3:

root@7f42a820c9c0:/usr/local/src# pgmodeler-cli -platform offscreen --export-to-file --input /models/plain93.dbm --output plain.sql

pgModeler 0.9.3 command line interface.
Starting model export...
Loading input file: /models/plain93.dbm
Export to SQL script file: /usr/local/src/plain.sql
Generating SQL code for PostgreSQL `'
[31%] Generating SQL code: `new_database' (Database)
[100%] Output SQL file `/usr/local/src/plain.sql' successfully written.
Export successfully ended!

Screenshots
If applicable, add screenshots to help explain your problem.

Info about your desktop

  • OS: Debian GNU/Linux (on Docker)
  • Version: 9 (stretch)
  • Window manager: XQuartz
  • pgModeler version: 0.9.4-alpha
  • Qt version:

Stacktrace / Debug info
No stacktrace was produced.

Additional info

  1. This was found to persist even when a display was provided.
  2. Exporting to PNG works fine in both versions.
  3. The GUI for 0.9.4-alpha and other features used works well from within that Docker container.
@rkhaotix
Copy link
Member

Hi @garetht

Maybe you've stumbled in a bug that I've already fixed in 0.9.4-alpha1 :)

I didn't test using docker but the result is supposed to be the same (since you have it working for 0.9.3 but not for 0.9.4-alpha). Anyway, I was able to run the command on 0.9.4-beta without any crash:

pgModeler command line interface.
Version 0.9.4-beta - 20210913.44c4bfffa Qt 5.15.1
PostgreSQL Database Modeler Project - pgmodeler.io
Copyright 2006-2021 Raphael Araújo e Silva <raphael@pgmodeler.io>

Starting model export...
Loading input file: /home/raphael/dbm_models/plain.dbm
Export to SQL script file: /home/raphael/pgmodeler/build/bin/plain.sql
Generating SQL code for PostgreSQL `13.0'
[31%] Generating SQL code: `new_database' (Banco de Dados)
[100%] SQL file `/home/raphael/pgmodeler/build/bin/plain.sql' successfully written.
Export successfully ended!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants