$HOME 폴더에 이상한 빈 bash_history-*.tmp 파일이 나타납니다.

$HOME 폴더에 이상한 빈 bash_history-*.tmp 파일이 나타납니다.

.bash_history-*.tmp내 홈 폴더에는 나도 모르게 같은 날(2021년 4월 16일)에 생성된 빈 폴더가 정확히 169개 있습니다. 파일에는 소유자에 대한 읽기 및 쓰기 권한만 있습니다. 이런 일이 발생하는 원인이 무엇인지 잘 모르겠습니다. 5년간의 Linux 여행(데스크톱 및 서버) 동안 이런 일이 일어난 적이 없습니다. 더 이상한 점은 내 기본 쉘이 bash가 아니라 zsh. 누군가가 정확히 무슨 일이 일어나고 있는지(가능한 경우) 또는 이전에 다른 사람에게 일어난 일인지 파악하는 데 도움을 줄 수 있다면 좋을 것입니다. 미리 감사드립니다. 여기있어

.-(~)(user@host)
`-->> find . -name '.*.tmp'
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-01407.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-01810.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-02487.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-03675.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08255.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08260.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08283.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08326.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08434.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08450.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08550.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08581.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08649.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08676.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08683.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08697.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08698.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08712.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08717.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08742.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08743.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08819.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08841.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08878.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08884.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08904.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08914.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-08962.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09060.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09116.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09157.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09201.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09212.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09228.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09247.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09248.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09265.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09274.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09283.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09331.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09366.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09397.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09445.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09501.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09507.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09548.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09597.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09632.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09701.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09760.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09904.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-09992.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10059.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10158.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10166.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10170.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10320.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10536.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10594.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10631.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10714.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-10753.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11127.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11189.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11494.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11514.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11697.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11774.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11827.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-11973.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12002.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12266.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12316.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12331.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12357.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12377.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12393.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12399.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12400.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12405.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12413.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12417.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12435.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12475.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12513.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12563.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12644.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12648.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12656.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12743.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12779.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12801.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12803.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12817.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12868.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-12971.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13005.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13013.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13020.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13033.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13042.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13047.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13065.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13074.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13089.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13090.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13092.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13094.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13097.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13099.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13145.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13162.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13184.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13202.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13203.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13206.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13208.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13218.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13219.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13220.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13250.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13313.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13316.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13320.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13322.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13323.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13341.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13360.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13388.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13489.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13530.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13566.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13575.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13576.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13630.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13640.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13675.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-13717.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14153.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14156.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14167.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14204.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14254.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14256.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14265.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14267.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14331.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14332.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14359.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14368.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14693.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14792.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14922.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14923.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14928.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14931.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14933.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14943.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14947.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14951.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14955.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-14968.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-30961.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-31005.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-31110.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-31142.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-32057.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-32358.tmp
-rw-------   1 user user   0 Apr 16 17:40 .bash_history-32434.tmp

참고: 누군가 나와 비슷한 게시물을 찾았습니다.아치리눅스 포럼그러나 그것은 내 질문에 대답하지 않습니다.

답변1

소스 코드 (Debian에서 사용 가능)는 bash파일의 함수를 사용하여 apt-get source bash히스토리 파일을 작성합니다 . 임시 파일을 생성하고 여기에 기록 줄을 쓴 다음 실제 기록 파일을 해당 파일로 바꿉니다.history_do_writebash-5.0/lib/readline/histfile.c

tempname = (overwrite && exists && S_ISREG (finfo.st_mode)) ? history_tempfile (histname) : 0;
output = tempname ? tempname : histname;

...

if (rv == 0 && histname && tempname)
  rv = histfile_restore (tempname, histname);

쓰기가 실패할 수 있는 곳이 많습니다. 이러한 경우 임시 파일의 링크가 해제(삭제)되고 원본 파일은 유지됩니다.

그러나 당신은코멘트 전달포크 폭탄을 터뜨렸습니다. 이것이 임시 파일의 근본 원인일 가능성이 높습니다. 제어할 수 없는 포크폭탄으로 인한 극심한 메모리 및 프로세스 압력으로 인해 bash이 복구 프로세스를 완료하는 데 사용할 수 있는 임시 메모리가 충분하지 않아 업데이트 시도 중에 단순히 충돌이 발생할 수 있습니다. (확실한 증거는 아니며 단지 가설일 뿐이라는 점을 참고하시기 바랍니다.)

사용자가 포크밤을 실행할 가능성이 있는 환경에 있다면 그만한 가치가 있습니다.리소스 제어 활성화.

답변2

확실하게 말할 수는 없지만 HISTFILEbash를 호출하기 전에 환경 변수가 변경될 수 있습니다(또는 다른 readline파일 기반 변수일 수도 있지만 문제는 $HISTFILE포함 이유입니다 .bash-history).

이는 단위 테스트(스위트)에서 수행할 작업처럼 들립니다.

$HOME/.bash_history나는 몇 분 동안 bash 소스 코드를 자세히 살펴보았는데 via를 제외하고 는 기본값과의 차이가 없는 것 같습니다 HISTFILE.

답변3

검색에 나온 SO글이라 답변은 여기에 두겠습니다.

이는 과잉의 결과일 가능성이 높습니다 $HISTSIZE.

20,000개의 항목으로 설정하려면 다음을 입력하세요 .bashrc.

export HISTSIZE=20000

무한대를 비워 두려면:

export HISTSIZE=

관련 정보