make test framework pass shellcheck#110
Conversation
…-d option (#105) "fd" is a pseudo file descriptor name for the purpose. See the following output on Linux; lsof doesn't print cwd, rtd, txt, and mem files. # ./lsof -p $$ -a -d fd COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME bash 866421 root 0u CHR 136,1 0t0 4 /dev/pts/1 bash 866421 root 1u CHR 136,1 0t0 4 /dev/pts/1 bash 866421 root 2u CHR 136,1 0t0 4 /dev/pts/1 bash 866421 root 255u CHR 136,1 0t0 4 /dev/pts/1 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
|
Thank you, but ... the change is too large for reviewing. You wrote what you did at the initial comment of this pull request. I prefer to single line if ~ then like: Did you run the test cases? With your change, the test cases are never run because the test harness gets an error. About CI platforms, you can ignore fresbsd1[1-3]. However, we cannot ignore Travis-CI where GNU/Linux runs.
This change breaks the harness. if $var is 0, the EXPRESSION in ((var++)) is 0 though $var is 1. |
|
This whole thing got much bigger than I'd intended; I started by looking at one file, and ended up auditing more than 20. I've already far exceeded the amount of time I wanted to spend on it, so it may be some time before I come back to it. I couldn't figure out how to run the integration checks in my branch; I expected that such a large change would probably break something, which is why I expressly asked to have it tested. The use of That said, the reliable fix is to preface Because this is commonly cited as a reason for preferring var=$((...)) over ((var=...)), I will ask Vidal about added this hint to Shellcheck, and consider incorporating it into my normal coding style. Many people prefer the "single line if", because it matches how they think of "if" in other languages. |
This is just a question. |
|
I did try to run what I could but obviously I missed that somehow. |
I see. |
|
I would like you to split this pull request to smaller commits when you find time. It is better to make new requests for each commits. I will merge them incrementally. NOTE: I will reject some of them if the change doesn't match my preference. I would like you to run the test cases locally before making a pull request. Let's me know if you don't know how to do it. |
This includes
#!/bin/shand.shwere wrong and misleading;var=$((var+1))to simply((var++))$varand$( cmd )expansions whereever they may be subject to wordsplitting or globbing;# shellcheck disable=in a few cases;${}and$()as they are almost indistinguishable in some fonts:$varover${var}wherever possible.$( cmd )(( expr ))for numeric operations including assignments and tests;$varinside(( ... ))[[ $x = *glob* ]]over[[ $x =~ .*regex.* ]];Note; I don't have access to test on all platforms, so I recommend re-running the test suite on all dialects when accepting these changes.