[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: set -a leads to truncated output from ps
From: |
alex xmb sw ratchev |
Subject: |
Re: set -a leads to truncated output from ps |
Date: |
Thu, 13 Jun 2024 15:31:55 +0200 |
try the ps arg w for full length ps output
why u set -a ?
On Thu, Jun 13, 2024, 3:29 PM Alain BROSSARD via Bug reports for the GNU
Bourne Again SHell <bug-bash@gnu.org> wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto
> -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security
> -Wall
> uname output: Linux admu01-rgr-gva 5.15.0-107-generic #117-Ubuntu SMP Fri
> Apr 26 12:26:49 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-pc-linux-gnu
>
> Bash Version: 5.1
> Patch Level: 16
> Release Status: release
>
> Description:
>
> I encountered this bug while tracing an issue within a third-party bash
> script.
> The following command wasn't detecting that the Neo4j Java application was
> running:
>
> ps ax | grep java | grep -i
> "com.neo4j.server.enterprise.EnterpriseEntryPoint" | grep -v grep | awk
> '{print $1}'
>
> In practice, ps ax | grep java is sufficient to illustrate the issue
> as shown below.
>
>
> host:/$ set -a
> # first execution of ps works fine as shown next
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:14 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp
> /icos/acm/apps/neo4j/plugins/*:/icos/acm/config/neo4j/*:/icos/acm/apps/neo4j/lib/*
> -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch
> -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields
> -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024
> -Dio.netty.tryReflectionSetAccessible=true
> -Djdk.tls.ephemeralDHKeySize=2048
> -Djdk.tls.rejectClientInitiatedRenegotiation=true
> -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions
> -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED
> --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
> -Dlog4j2.disable.jmx=true
> -Xlog:gc*,safepoint,age*=trace:file=/icos/acm/logs/neo4j/gc.log::filecount=5,filesize=20480k
> -Dfile.encoding=UTF-8 -Xms4194304k -Xmx8388608k
> com.neo4j.server.enterprise.EnterpriseEntryPoint
> --home-dir=/icos/acm/apps/neo4j --config-dir=/icos/acm/config/neo4j
>
> # however, the second one has truncated output to the terminal width
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:14 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp /icos/acm/apps/neo4j/plug
>
> At this stage, only a restart of the bash shell seems to fix the
> issue. All output from ps is now truncated even when passed through a
> pipe. I haven't found a work-around once this bug is triggered. I’ve
> compared the environment variables before and after and same for output
> from stty -a and found no difference.
>
> Assigning to a variable within an 'if' or after either '||' or '&&'
> also triggers the problem. Example, the following code triggers the bug:
>
> icos%cobfm03-uat-gva[167] bash
> # ps output is good
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:16 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp
> /icos/acm/apps/neo4j/plugins/*:/icos/acm/config/neo4j/*:/icos/acm/apps/neo4j/lib/*
> -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch
> -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields
> -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024
> -Dio.netty.tryReflectionSetAccessible=true
> -Djdk.tls.ephemeralDHKeySize=2048
> -Djdk.tls.rejectClientInitiatedRenegotiation=true
> -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions
> -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED
> --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
> -Dlog4j2.disable.jmx=true
> -Xlog:gc*,safepoint,age*=trace:file=/icos/acm/logs/neo4j/gc.log::filecount=5,filesize=20480k
> -Dfile.encoding=UTF-8 -Xms4194304k -Xmx8388608k
> com.neo4j.server.enterprise.EnterpriseEntryPoint
> --home-dir=/icos/acm/apps/neo4j --config-dir=/icos/acm/config/neo4j
> host:/$ set -a
> host:/$ echo $PATH | grep -q reyl/scripts || PATH=${PATH}:/reyl/scripts
> # ps output is now always truncated, even if/after we call ‘unset +a’.
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:16 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp /icos/acm/apps/neo4j/plug
>
> replace PATH= by { PATH=... } also triggers the bug. Using 'if' also
> triggers it.
>
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:17 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp
> /icos/acm/apps/neo4j/plugins/*:/icos/acm/config/neo4j/*:/icos/acm/apps/neo4j/lib/*
> -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch
> -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields
> -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024
> -Dio.netty.tryReflectionSetAccessible=true
> -Djdk.tls.ephemeralDHKeySize=2048
> -Djdk.tls.rejectClientInitiatedRenegotiation=true
> -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions
> -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED
> --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
> -Dlog4j2.disable.jmx=true
> -Xlog:gc*,safepoint,age*=trace:file=/icos/acm/logs/neo4j/gc.log::filecount=5,filesize=20480k
> -Dfile.encoding=UTF-8 -Xms4194304k -Xmx8388608k
> com.neo4j.server.enterprise.EnterpriseEntryPoint
> --home-dir=/icos/acm/apps/neo4j --config-dir=/icos/acm/config/neo4j
> host:/$ set -a
> host:/$ if echo $PATH | grep -q java ; then
> > PATH=${PATH}:/reyl/scripts
> > fi
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:17 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp /icos/acm/apps/neo4j/plug
> host:/$ exit
>
>
> Work-around that works is to assign a variable within $( ) and set
> +a :
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:18 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp
> /icos/acm/apps/neo4j/plugins/*:/icos/acm/config/neo4j/*:/icos/acm/apps/neo4j/lib/*
> -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch
> -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields
> -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024
> -Dio.netty.tryReflectionSetAccessible=true
> -Djdk.tls.ephemeralDHKeySize=2048
> -Djdk.tls.rejectClientInitiatedRenegotiation=true
> -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions
> -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED
> --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
> -Dlog4j2.disable.jmx=true
> -Xlog:gc*,safepoint,age*=trace:file=/icos/acm/logs/neo4j/gc.log::filecount=5,filesize=20480k
> -Dfile.encoding=UTF-8 -Xms4194304k -Xmx8388608k
> com.neo4j.server.enterprise.EnterpriseEntryPoint
> --home-dir=/icos/acm/apps/neo4j --config-dir=/icos/acm/config/neo4j
> host:/$ set -a
> host:/$ opta_is_set=$(echo $- | grep -q a && echo 1 )
> # record whether -a is set or not, this must be done within $( ) or
> the bug gets triggered
> host:/$ set +a
> # change the PATH as required after unseting -a
> host:/$ echo $PATH | grep -q reyl/scripts || PATH=${PATH}:/reyl/scripts
> # no bug, ps output isn't truncated
> host:/$ ps ax | grep java | grep -v grep
> 645101 pts/2 Sl 8:19 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp
> /icos/acm/apps/neo4j/plugins/*:/icos/acm/config/neo4j/*:/icos/acm/apps/neo4j/lib/*
> -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:+AlwaysPreTouch
> -XX:+UnlockExperimentalVMOptions -XX:+TrustFinalNonStaticFields
> -XX:+DisableExplicitGC -Djdk.nio.maxCachedBufferSize=1024
> -Dio.netty.tryReflectionSetAccessible=true
> -Djdk.tls.ephemeralDHKeySize=2048
> -Djdk.tls.rejectClientInitiatedRenegotiation=true
> -XX:FlightRecorderOptions=stackdepth=256 -XX:+UnlockDiagnosticVMOptions
> -XX:+DebugNonSafepoints --add-opens=java.base/java.nio=ALL-UNNAMED
> --add-opens=java.base/java.io=ALL-UNNAMED
> --add-opens=java.base/sun.nio.ch=ALL-UNNAMED
> -Dlog4j2.disable.jmx=true
> -Xlog:gc*,safepoint,age*=trace:file=/icos/acm/logs/neo4j/gc.log::filecount=5,filesize=20480k
> -Dfile.encoding=UTF-8 -Xms4194304k -Xmx8388608k
> com.neo4j.server.enterprise.EnterpriseEntryPoint
> --home-dir=/icos/acm/apps/neo4j --config-dir=/icos/acm/config/neo4j
> # as part of the work-around, we reset -a to its prior state and
> continue
> host:/$ [ $opta_is_set == 1 ] && set -a
> host:/$ unset -v opta_is_set
>
>
> Repeat-By:
>
> set -a
> ps as | grep 'find a long line'
> # next ps output gets truncated and all subsequent executions until we
> exit the shell
> ps as | grep 'find a long line'
>
>
>
> [cid:ISP-REYL_HubSWS_Col_email_v2_88f4ea19-df87-4cc1-aef3-c28f2127924c.png]<
> http://www.reyl.com>
>
> Alain BROSSARD
> System & Network Administrator
> Technology
>
> D +41 22 816 8607<tel:+41%2022%20816%208607>
> M +41 79 612 2336<tel:+41%2079%20612%202336>
> T +41 22 816 8600<tel:+41%2022%20816%208600>
> F +41 22 816 8009<tel:+41%2022%20816%208009>
> abrossard@reyl.com<mailto:abrossard@reyl.com>
>
> REYL & Cie SA
> Rue du Rhône 4
> 1204 Genève
> www.reyl.com<https://www.reyl.com>
>
> [cid:SUCCES.TOGETHER_RVB_email_345119d7-0ea9-4fc1-b2e0-c31313eae094.png]
> ________________________________
> The information contained in email messages from REYL & Cie SA may contain
> confidential, proprietary or legally privileged information and is intended
> only for the use of the addressee named above. No confidentiality or
> privilege is waived or lost by any mis-transmission. If you are not the
> addressee of this email message, you must not use, distribute, copy it in
> any form or take any action in reliance on it. If you have received this
> email message by error, please notify us immediately by replying to the
> message and delete it from your computer. If there are any attachments to
> the email messages that you received in error, kindly refrain from opening
> them and do not download or save them to your computer. In accordance with
> industry standards and practices, and to comply with our legal and
> regulatory retention requirement REYL & Cie SA monitors and retains email
> messages for a period of time in accordance with its policies, guidelines
> and procedures. Email transmission cannot be guaranteed to be secured or
> error-free as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses. REYL & Cie SA is not liable
> for any unproper or incomplete transmission of the information contained in
> email messages or for any delay it their receipt. Some publications
> included in email message may be advertising material (pursuant to Art. 68
> of the Federal Act on Financial Services, Financial Services Act of 15 June
> 2018) for financial services or for financial instruments. For any
> financial instruments mentioned, we will be happy to provide you with
> additional documents at any time and free of charge, such as a key
> information document pursuant to Art. 58 et seq. of the Financial Services
> Act, a prospectus pursuant to Art. 35 et seq. of the Financial Services Act
> or an equivalent foreign product information sheet, e.g. a basic
> information sheet pursuant to Regulation EU 1286/2014 for packaged
> investment products for retail investors and insurance investment products
> (PRIIPS KID). We consider your inquiries about our products and services as
> a request to contact you and send you relevant information.
>
- set -a leads to truncated output from ps, Alain BROSSARD, 2024/06/13
- Re: set -a leads to truncated output from ps,
alex xmb sw ratchev <=
- RE: set -a leads to truncated output from ps, Alain BROSSARD, 2024/06/13
- Re: set -a leads to truncated output from ps, Oğuz, 2024/06/13
- Re: set -a leads to truncated output from ps, alex xmb sw ratchev, 2024/06/13
- it, soRE: set -a leads to truncated output from ps, Alain BROSSARD, 2024/06/13
- Re: it, soRE: set -a leads to truncated output from ps, Oğuz, 2024/06/13
- RE: it, soRE: set -a leads to truncated output from ps, Alain BROSSARD, 2024/06/13
- Re: it, soRE: set -a leads to truncated output from ps, Greg Wooledge, 2024/06/13
- Re: it, soRE: set -a leads to truncated output from ps, alex xmb sw ratchev, 2024/06/14