Skip to content

file-nullbyte messes up terminal (when run against binary files?) #14

@kbabioch

Description

@kbabioch

The file-nullbyte check seems to mess up terminals. I've checked it on multiple *nix machines (Linux, macOS) and the terminals are only showing "weird" characters and/or behave strangely, after the following command is run:

docker run --rm -v $(pwd):/data cytopia/file-lint file-nullbyte --path .

$(pwd) is the checked out repository, and contains some binary files inside the .git/ directory

The result looks something like this:

W7Om,ҧ)ӘG2
R2        iG:U!%{|=7h>r$rCzيZWbnڒ0[~`ٻ@|?B屙QlW`/UA=~F};aL_ٚ1xmIo@Mܬ
m99φiXn t?0LӚbΤy`QV(oWiƯk0vUpC6`yn]s_I+}R*g\7r3A@B{<lkuH5nY?$ebxjbBxiX9MyCgm5؈c$1qP&uQUF        xYÙx</JNI?6,D"(A(r)N<
                                                                            r$R%T-@&^(~%Yk175,c1omiwziìĿXC7;zgY6co<
                                                                                                                   fwSXSdme^Z(NЉ*lw]Tl3
                                                                                                                                       g<k..NL(K)hv9&5տlX9=-k
W3~?lwKzBwEP?Wipx|4q.YF1~K93e36ef28bb545f9c4650c7f13ce2f59b442180.pack:|* #*-2Ds*2E%к<  d_xږGՕYSOb9'YIz9sU_~^ @wYdrҴ:x/U5ӧHtYaYbNla|0m쇷k7XYpi1;
                          *h#!o<Ov6thOQ]&r5Sk$wɄ_N>VSh"ldRD@nt?|hk]fi7Li9(i؄TP
                                                                             k,ć|9g4}w0
                                                                                       nrua,
;r͎¨rvz֍Ki+d瑿AAeOV\cp?Z,<*f{woYvMSTytVnZ*                                                   F9W_̲D037웨5yi{:0~PgBӌĥ-]w˷z         ەG3L:#;@X*
                                         :i6bp?%XF?R    ѮCSa8[fOga1xmKs@ڣ"Hb}dOSWW35UNTE
./.git/objects/pack/pack-693e36ef28bb545f9c4650c7f13ce2f59b442180.pack:BrR1Ρ$AEgͤyLi(UXIDDAD!%5S          CAMV   !PCrOC<34EU'
qsɽM)epKũ                                                                                                                   U@ ⶮa`XŰ)xlZκjzΊ!,벾2Lo -OE[O.\z#6tXz`/Ѥbk8j^׳'k^؍fgOv
./.git/objects/pack/pack-693e36ef28bb545f9c4650c7f13ce2f59b442180.pack:c2ljxvPAMyFX
vIDu]E\S'v SAHSەB,%;3mSUU䡝<5s
                              f#G9duyu4}|JdS6-Ox_oT_6g
                                                      tcUN#M)oHڸUq
                                                                  %I~XDxSˮFQk#6e

                                                                                |}dUzUV]dƀ)b
./.git/objects/pack/pack-693e36ef28bb545f9c4650c7f13ce2f59b442180.pack:3
LkftbFPpHx54H}/pack/pack-693e36ef28bb545f9c4650c7f13ce2f59b442180.pack:-+z\gָ| y(Bdr\[k8'c9(yt;Umc

The terminal needs to be reset afterwards.

The example snippet for this check looks like this:

# file-crlf
FILE_NULLBYTE_EXTENSION=""
FILE_NULLBYTE_IGNORE=".git,*.svn,*.pyc"
FILE_NULLBYTE_TEXT=0
FILE_NULLBYTE_SIZE=1

This results in binary files being scanned.

Now I'm wondering:

  • Is it a good idea to run this check against binary files in the first place?
  • Why is it messing up the terminal? This should not happen, regardless of whether binary files are involved or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions