Issue Details (XML | Word | Printable)

Key: CORE-4944
Type: Improvement Improvement
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: Pavel Zotov
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Firebird Core

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

Created: 23/Sep/15 07:06 PM   Updated: 28/Sep/15 06:30 PM
Component/s: ISQL
Affects Version/s: 2.5.0, 2.5.1, 2.5.2, 2.5.2 Update 1, 2.5.3, 2.5.3 Update 1, 2.5.4
Fix Version/s: None

QA Status: No test


 Description  « Hide
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 ?


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sean Leyne added a comment - 23/Sep/15 07:59 PM
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").

Adriano dos Santos Fernandes added a comment - 23/Sep/15 08:10 PM
Sean? So there should be no point releases if bugs are declared to be features.

Pavel Zotov added a comment - 23/Sep/15 08:25 PM - edited
> 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!

Sean Leyne added a comment - 23/Sep/15 08:37 PM
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.

Pavel Zotov added a comment - 23/Sep/15 08:46 PM
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.

Adriano dos Santos Fernandes added a comment - 24/Sep/15 01:26 AM
> 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!

Pavel Zotov added a comment - 24/Sep/15 05:23 AM
> 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.

Adriano dos Santos Fernandes added a comment - 28/Sep/15 03:47 PM
Cannot reproduce in Linux with:

cat file | isql

Did you tested fresh 2.5 branch/snapshot?

Pavel Zotov added a comment - 28/Sep/15 06:30 PM
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>
===