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

Suppress output of "SQL>" and "CON>" prompts in ISQL in 2.5.x and 3.0 when it get commands through OS pipe mechanism [CORE4944] #5235

Open
firebird-automations opened this issue Sep 23, 2015 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Create empty database in FB 2.5 (I've assigned to it alias = 'oltp25') and following text file:

connect '/3255:oltp25';
set list on;

select
mon$attachment_id
,mon$server_pid
,mon$state
,mon$attachment_name
,mon$user
,mon$role
,mon$remote_protocol
,mon$remote_address
,mon$remote_pid
,mon$character_set_id
,mon$timestamp
,mon$garbage_collection
,mon$remote_process
,mon$stat_id
from mon$attachments
where mon$attachment_id = current_connection
;

show version;

exit;

Note: this file does contain empty lines. Just for readability :-)

Then try to send tis file in STDOUT (using TYPE command on Windows) and PIPE this output to ISQL, but use:
1) ISQL of 2.5
2) ISQL of 3.0.

You'll get following results:

1) when use ISQL of 2.5:

C:\...>type pipetest.sql | C:\MIX\firebird\fb25\bin\isql.exe -q
SQL> Database: '/3255:oltp25'
SQL> SQL> SQL> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON>
MON$ATTACHMENT_ID 43
MON$SERVER_PID 1280
MON$STATE 1
MON$ATTACHMENT_NAME oltp25
MON$USER SYSDBA
MON$ROLE NONE
MON$REMOTE_PROTOCOL TCPv4
MON$REMOTE_ADDRESS 192.168.43.154
MON$REMOTE_PID 2504
MON$CHARACTER_SET_ID 0
MON$TIMESTAMP 2015-09-23 21:54:11.8780
MON$GARBAGE_COLLECTION 1
MON$REMOTE_PROCESS C:\MIX\firebird\fb25\bin\isql.exe
MON$STAT_ID 2

SQL> SQL> ISQL Version: WI-V2.5.5.26929 Firebird 2.5
Server version:
Firebird/x86/Windows NT (access method), version "WI-V2.5.5.26929 Firebird 2.5"
Firebird/x86/Windows NT (remote server), version "WI-V2.5.5.26929 Firebird 2.5/tcp (csprog)/P12"
Firebird/x86/Windows NT (remote interface), version "WI-V2.5.5.26929 Firebird 2.5/tcp (csprog)/P12"
on disk structure version 11.2
SQL> SQL>

2) when use ISQL of 3.0:

C:\...>type pipetest.sql | C:\MIX\firebird\fb30\isql.exe -q

MON$ATTACHMENT_ID 42
MON$SERVER_PID 1280
MON$STATE 1
MON$ATTACHMENT_NAME oltp25
MON$USER SYSDBA
MON$ROLE NONE
MON$REMOTE_PROTOCOL TCPv4
MON$REMOTE_ADDRESS 192.168.43.154
MON$REMOTE_PID 3964
MON$CHARACTER_SET_ID 0
MON$TIMESTAMP 2015-09-23 21:54:07.9720
MON$GARBAGE_COLLECTION 1
MON$REMOTE_PROCESS C:\MIX\firebird\fb30\isql.exe
MON$STAT_ID 2

ISQL Version: WI-V3.0.0.32047 Firebird 3.0 Release Candidate 1
Server version:
Firebird/Windows/Intel/i386 (access method), version "WI-V2.5.5.26929 Firebird 2.5"
Firebird/Windows/Intel/i386 (remote server), version "WI-V2.5.5.26929 Firebird 2.5/tcp (csprog)/P12"
Firebird/Windows/Intel/i386 (remote interface), version "WI-V3.0.0.32047 Firebird 3.0 Release Candidate 1/tcp (csprog)/P12"
on disk structure version 11.2

One may see that ISQL 2.5 produces lot of 'dirty' tokens in its output, such as "SQL>" and "CON>". And also it ignores command switch '-q' and produces name of database ("Database: '/3255:oltp25'").

Can these unneeded tokens be suppressed in its output ?

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Unless the 2.5.x output is a regression from 2.0.x, I would say that 2.5.x should remain as is.

While I agree that it is 'dirty', it is how it has always been. (so this case should be closed "As designed/Wont fix").

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Sean? So there should be no point releases if bugs are declared to be features.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

> I would say that 2.5.x should remain as is.

I can imagine only one environment where this dirty output should be taken in account: some tests.
And I saw a lot of .fbt files with ugly "CON> CON> CON> ..." lines in expected_stdout section. If source script will be occasionally modified with just adding one *empty* line between statements - test will fail. Exactly because of this strange and BAD behaviour of ISQL.

From this POV you're right - it will be better to leave ISQL 2.5 behaviour as current.

But one may to add new command switch to suppress these "CON> CON>" - for example, '-nop[rompt]'.

So, I urge: do not close this ticket with 'won`t fix' resolution!

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Adriano,

My view is: I can't know how someone might be using/parsing the piped ISQL output.

As such, within the context of a point-release (especially a late release), we should not be changing some minor annoyances. Even more so, if the next major release changes/fixes the issue and is close to release.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

This:

> one may to add new command switch to suppress these "CON> CON>"

-- can be done anyway. If this switch will not be specified in command, no any expectations of these prompts will be broken.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

> one may to add new command switch to suppress these "CON> CON>"

Totally against it.

If you do not want the thing fixed nor want the ticket marked as rejected, then why you created it? Please delete then!

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

> If you do not want the thing fixed

I've create this ticket with exactly one goal: want to have ability suppress these dummy prompts.
Eventually, even if you will fix it without adding command switch, all problem fbt files can be easy fixed at one day - it will be just routine.

Currently this output can not be normally parsed or parsed.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Cannot reproduce in Linux with:

cat file | isql

Did you tested fresh 2.5 branch/snapshot?

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Yes, seems that this effect can be seen only on Windows (just checked on Linux - no such "CON> CON>" lines, so you're right).
On current FB 2.5.5 snapshot:

C:\MIX\firebird\fb25>type test4944.sql | C:\MIX\firebird\fb25\bin\isql -q
SQL> Database: '/3255:e25'
SQL> SQL> SQL> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON> CON>
MON$ATTACHMENT_ID 8
MON$SERVER_PID 2856
MON$STATE 1
MON$ATTACHMENT_NAME e25
MON$USER SYSDBA
MON$ROLE NONE
MON$REMOTE_PROTOCOL TCPv4
MON$REMOTE_ADDRESS 192.168.43.154
MON$REMOTE_PID 3360
MON$CHARACTER_SET_ID 0
MON$TIMESTAMP 2015-09-28 21:28:39.3120
MON$GARBAGE_COLLECTION 1
MON$REMOTE_PROCESS C:\MIX\firebird\fb25\bin\isql.exe
MON$STAT_ID 2

SQL> SQL> ISQL Version: WI-V2.5.5.26933 Firebird 2.5
Server version:
Firebird/x86/Windows NT (access method), version "WI-V2.5.5.26933 Firebird 2.5"
Firebird/x86/Windows NT (remote server), version "WI-V2.5.5.26933 Firebird 2.5/tcp (csprog)/P12"
Firebird/x86/Windows NT (remote interface), version "WI-V2.5.5.26933 Firebird 2.5/tcp (csprog)/P12"
on disk structure version 11.2
SQL> SQL>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment