[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 16:22:58 +0200 |
it looks like normal cut ps out
try .. ps axw
maybe be some terminal lines 2nd+ hashing error
On Thu, Jun 13, 2024, 3:46 PM Alain BROSSARD <abrossard@reyl.com> wrote:
> Hi,
>
>
>
> The why doesn’t matter, but it is a third party software package.
> They source different files from different location which define variables.
> They set -a before and +a after. I’m stuck in the middle. As long as I
> didn’t trigger the bug, it didn’t matter.
>
>
>
> Changing the parameters of ps, is beside the point. It works fine as
> is if we don’t trigger this bug. Beside I would have to modify at least 6
> different scripts which come with this software package. There is also
> that this doesn’t fix the problem :
>
>
>
> Here is a proof that using ‘w’ doesn’t fix the issue :
>
>
>
> $ set -a
>
> # First ps works just fine
>
> $ ps ax | grep java | grep -v grep
>
> … long ps output…
> /icos/acm/apps/karaf-server/lib/boot/org.apache.karaf.jaas.boot-4.4.3.jar:/icos/acm/apps/karaf-server/lib/boot/org.apache.karaf.main-4.4.3.jar:/icos/acm/apps/karaf-server/lib/boot/org.apache.karaf.specs.activator-4.4.3.jar:/icos/acm/apps/karaf-server/lib/boot/osgi.core-8.0.0.jar:/icos/acm/apps/karaf-server/lib/jdk9plus/istack-commons-runtime-3.0.10.jar:/icos/acm/apps/karaf-server/lib/jdk9plus/jakarta.xml.bind-api-2.3.3.jar:/icos/acm/apps/karaf-server/lib/jdk9plus/javax.annotation-api-1.3.2.jar:/icos/acm/apps/karaf-server/lib/jdk9plus/jaxb-runtime-2.3.3.jar:/icos/acm/apps/karaf-server/lib/jdk9plus/org.apache.servicemix.specs.activation-api-1.2.1-1.2.1_3.jar:/icos/acm/apps/karaf-server/lib/jdk9plus/txw2-2.3.3.jar
> org.apache.karaf.main.Main
>
> # All the next ps have truncated output
>
> host:/$ ps ax | grep java | grep -v grep
>
> 2051669 ? Sl 0:04 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -Xms2g -Xmx2g -server -XX:+Us
>
> 2052152 ? Sl 2:01 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -Xms2g -Xmx2g -server -XX:+Us
>
> 2052632 ? Sl 0:54 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -server -Xms2g -Xmx2g -XX:+Us
>
> 2052917 ? Sl 2:31 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp /icos/acm/apps/neo4j/plug
>
> 2054219 ? Sl 6:36 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -XX:+UnlockDiagnosticVMOption
>
> # with ‘w’ option, doesn’t change much, just adds a few more chars at end.
>
> host:/$ ps awx | grep java | grep -v grep
>
> 2051669 ? Sl 0:04 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -Xms2g -Xmx2g -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20
>
> 2052152 ? Sl 2:01 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -Xms2g -Xmx2g -server -XX:+UseG1GC -XX:MaxGCPauseMillis=20
>
> 2052632 ? Sl 0:54 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -server -Xms2g -Xmx2g -XX:+UseG1GC -XX:+PerfDisableSharedMe
>
> 2052917 ? Sl 2:31 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -cp /icos/acm/apps/neo4j/plugins/*:/icos/acm/config/neo4j/*
>
> 2054219 ? Sl 6:36 /usr/lib/jvm/java-17-openjdk-amd64/bin/java
> -XX:+UnlockDiagnosticVMOptions -Xms6g -Xmx6g --add-reads=ja
>
>
>
> The ps goes through a PIPE, its output should never get truncated.
>
>
>
> Regards,
>
> Alain
>
>
>
> <http://www.reyl.com>
>
> *Alain BROSSARD*
> System & Network Administrator
> Technology
>
> D +41 22 816 8607 <+41%2022%20816%208607>
> M +41 79 612 2336 <+41%2079%20612%202336>
> T +41 22 816 8600 <+41%2022%20816%208600>
> F +41 22 816 8009 <+41%2022%20816%208009>
> abrossard@reyl.com
>
> *REYL & Cie SA*
> Rue du Rhône 4
> 1204 Genève
> *www.reyl.com* <https://www.reyl.com>
>
> ------------------------------
> 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.
>
> *From:* alex xmb sw ratchev <fxmbsw7@gmail.com>
> *Sent:* Thursday, June 13, 2024 3:32 PM
> *To:* Alain BROSSARD <abrossard@reyl.com>
> *Cc:* bug-bash@gnu.org
> *Subject:* Re: set -a leads to truncated output from ps
>
>
>
> 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
>
> ZjQcmQRYFpfptBannerStart
>
> *This Message Is From an Untrusted Sender *
>
> This message was sent from outside of *REYL & CIE*.
> You have not previously corresponded with this sender.
>
> * Report Suspicious *
> <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/HLcdjgI!MxEYukcrhqUO4Xuin4mvk9H4XbjEO1w8IDPEZhbES8WCBZswxwsKChFM_zuI8ZPSfa-J2KXk30f6XK8o_wf79dZfLkaVal5Y_0pB6Jy8dEhnIswbfGAE7ege8Q$>
>
>
>
> ZjQcmQRYFpfptBannerEnd
>
> 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 <+41%2022%20816%208607>>
> M +41 79 612 2336<tel:+41%2079%20612%202336 <+41%2079%20612%202336>>
> T +41 22 816 8600<tel:+41%2022%20816%208600 <+41%2022%20816%208600>>
> F +41 22 816 8009<tel:+41%2022%20816%208009 <+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, 2024/06/13
- 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
- Re: it, soRE: set -a leads to truncated output from ps, Robert Elz, 2024/06/13
Re: set -a leads to truncated output from ps, Andreas Schwab, 2024/06/13