You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "deepujain (via GitHub)" <gi...@apache.org> on 2026/03/27 06:51:36 UTC

[PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

deepujain opened a new pull request, #8387:
URL: https://github.com/apache/hadoop/pull/8387

   Summary
   Avoid invoking `tput` when it is not installed, so Hadoop shell usage formatting works on minimal distros without ncurses.
   
   Change
   - `hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh`: guard the terminal-width probe with `command -v tput` and fall back cleanly to the default width.
   - `hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommands.bats`: add a regression for the missing-`tput` path.
   
   JIRA
   Fixes HADOOP-19758
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "deepujain (via GitHub)" <gi...@apache.org>.
deepujain commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4292896866

   Follow-up push for the latest Yetus failure: the new bats test was masking more than just tput because the simulated PATH also removed fold, so the expected archive-logs output never printed in CI. I updated the test fixture to keep fold available while still simulating missing tput, then force-pushed the amended single commit. Local validation passed with the same narrowed shell repro: source hadoop-functions.sh, expose only sort and fold on PATH, unset COLUMNS, and confirm hadoop_generic_columnprinter still prints archive-logs output without a tput error.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "deepujain (via GitHub)" <gi...@apache.org>.
deepujain commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4923533920

   CI is still green on the current head, and this one has been waiting a while for committer review. @steveloughran, when you have a moment, could you please take a look? Happy to make any follow-up changes, and if there is a better reviewer for this shell/common change I can loop them in.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#discussion_r3424137578


##########
hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh:
##########
@@ -375,9 +375,11 @@ function hadoop_generic_columnprinter
 
   if [[ -n "${COLUMNS}" ]]; then
     numcols=${COLUMNS}
-  else
-    numcols=$(tput cols) 2>/dev/null
-    COLUMNS=${numcols}
+  elif command -v tput >/dev/null 2>&1; then
+    numcols=$(tput cols 2>/dev/null)
+    if [[ "${numcols}" =~ ^[0-9]+$ ]]; then
+      COLUMNS=${numcols}
+    fi

Review Comment:
   This code change looks fine, but I'm not sure how useful it is. tput is pretty common, and it's really not a problem to assume it's there as a prerequisite.
   
   That said, the curlies and the quotes on the left side of the if statement aren't needed, nor are the curlies in the assignment to COLUMNS, but there seems to be an excess of these unnecessary things throughout the script, so these aren't really that much of a problem.



##########
hadoop-common-project/hadoop-common/src/test/scripts/hadoop_subcommands.bats:
##########


Review Comment:
   I don't know how the test works, so I didn't check it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "hadoop-yetus (via GitHub)" <gi...@apache.org>.
hadoop-yetus commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4293119784

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |:----:|----------:|--------:|:--------:|:-------:|
   | +0 :ok: |  reexec  |   0m 21s |  |  Docker mode activated.  |
   |||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  |
   | +0 :ok: |  shelldocs  |   0m  0s |  |  Shelldocs was not available.  |
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to include 1 new or modified test files.  |
   |||| _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  25m 32s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m 12s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  14m 56s |  |  branch has no errors when building and testing our client artifacts.  |
   |||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   0m 42s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks issues.  |
   | +1 :green_heart: |  mvnsite  |   0m 54s |  |  the patch passed  |
   | +1 :green_heart: |  shellcheck  |   0m  2s |  |  No new issues.  |
   | +1 :green_heart: |  shadedclient  |  14m 27s |  |  patch has no errors when building and testing our client artifacts.  |
   |||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |   1m 14s |  |  hadoop-common in the patch passed.  |
   | +1 :green_heart: |  asflicense  |   0m 25s |  |  The patch does not generate ASF License warnings.  |
   |  |   |  61m 32s |  |  |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/3/artifact/out/Dockerfile |
   | GITHUB PR | https://github.com/apache/hadoop/pull/8387 |
   | Optional Tests | dupname asflicense mvnsite unit codespell detsecrets shellcheck shelldocs |
   | uname | Linux 592b64b635f5 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / 99aa5d8f15eff7e413b9cca2d3b9291a576fb069 |
   |  Test Results | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/3/testReport/ |
   | Max. process+thread count | 645 (vs. ulimit of 10000) |
   | modules | C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common |
   | Console output | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/3/console |
   | versions | git=2.43.0 maven=3.9.11 shellcheck=0.9.0 |
   | Powered by | Apache Yetus 0.14.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang merged PR #8387:
URL: https://github.com/apache/hadoop/pull/8387


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "hadoop-yetus (via GitHub)" <gi...@apache.org>.
hadoop-yetus commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4291124068

   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |:----:|----------:|--------:|:--------:|:-------:|
   | +0 :ok: |  reexec  |   7m 16s |  |  Docker mode activated.  |
   |||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  |
   | +0 :ok: |  shelldocs  |   0m  0s |  |  Shelldocs was not available.  |
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to include 1 new or modified test files.  |
   |||| _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  26m 52s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m  8s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  15m 12s |  |  branch has no errors when building and testing our client artifacts.  |
   |||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   0m 42s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks issues.  |
   | +1 :green_heart: |  mvnsite  |   0m 52s |  |  the patch passed  |
   | +1 :green_heart: |  shellcheck  |   0m  3s |  |  No new issues.  |
   | -1 :x: |  shadedclient  |   2m 38s |  |  patch has errors when building and testing our client artifacts.  |
   |||| _ Other Tests _ |
   | -1 :x: |  unit  |   1m 12s | [/patch-unit-hadoop-common-project_hadoop-common.txt](https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/2/artifact/out/patch-unit-hadoop-common-project_hadoop-common.txt) |  hadoop-common in the patch failed.  |
   | +1 :green_heart: |  asflicense  |   0m 20s |  |  The patch does not generate ASF License warnings.  |
   |  |   |  58m 10s |  |  |
   
   
   | Reason | Tests |
   |-------:|:------|
   | Failed TAP tests | hadoop_subcommands.bats.tap |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | ClientAPI=1.54 ServerAPI=1.54 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/2/artifact/out/Dockerfile |
   | GITHUB PR | https://github.com/apache/hadoop/pull/8387 |
   | Optional Tests | dupname asflicense mvnsite unit codespell detsecrets shellcheck shelldocs |
   | uname | Linux 9731dae77d8e 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / e89beada5159e71cc223790ad31b6aff66a1d252 |
   | TAP logs |  https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/2/artifact/out/patch-hadoop-common-project_hadoop-common.tap |
   |  Test Results | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/2/testReport/ |
   | Max. process+thread count | 612 (vs. ulimit of 10000) |
   | modules | C: hadoop-common-project/hadoop-common U: hadoop-common-project/hadoop-common |
   | Console output | https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8387/2/console |
   | versions | git=2.43.0 maven=3.9.11 shellcheck=0.9.0 |
   | Powered by | Apache Yetus 0.14.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4926872938

   Merged. Thanks @deepujain for contributing the fix. @ctubbsii for reviews.
   
   I'd like to port this to Ozone.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "deepujain (via GitHub)" <gi...@apache.org>.
deepujain commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4140578504

   Fixed the usage formatter to skip `tput` when it is unavailable and added a regression for the missing-`tput` path. I also verified the formatter directly in a PATH without `tput`, and it prints cleanly now. Ready for review.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "edwardcapriolo (via GitHub)" <gi...@apache.org>.
edwardcapriolo commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4141889014

   Cool nice job. When i mentioned it I never thought someone else wold fix! I just installed ncurses in my docker.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "steveloughran (via GitHub)" <gi...@apache.org>.
steveloughran commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4924218101

   @deepujain i am really cutting back on my OSS work to approximately zero in the next fortnight, so expect this to be last review. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "deepujain (via GitHub)" <gi...@apache.org>.
deepujain commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4290769810

   Rebased this onto current apache/trunk and force-pushed the refreshed branch. Local validation for the narrow shell change passed by sourcing hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh, simulating a PATH without tput, and verifying hadoop_generic_columnprinter still prints the expected archive-logs usage text without a tput error message. I also confirmed the branch still contains the matching bats regression in hadoop_subcommands.bats.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "steveloughran (via GitHub)" <gi...@apache.org>.
steveloughran commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4924316334

   I'm not a bash coder; I don't even use it as my shell (fish, having used tcsh before). ask on common dev list for reviews. Sorry.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Re: [PR] HADOOP-19758. Avoid tput in shell usage formatting when unavailable. [hadoop]

Posted by "deepujain (via GitHub)" <gi...@apache.org>.
deepujain commented on PR #8387:
URL: https://github.com/apache/hadoop/pull/8387#issuecomment-4702331874

   CI is still green on the current head, and this one has been sitting quietly for a while. @ctubbsii @EnricoMi, when you have a moment, could you please take a look? Happy to make any follow-up changes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org