Description of problem: ======================= /usr/bin/which fails for long path Version-Release number of selected component (if applicable): which-2.21-17.el8.x86_64 How reproducible: ==================== Steps to Reproduce: ------------------- 1. Create Directory with long path # mkdir -p /tmp/1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000/1111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000/11111111112222222222333333333344444444445555555555 2. Change directory to the created one # cd !$ 3. Execute which command # which cd Actual results: ================= Fails with error: Can't get current working directory Expected results: =================== Should show below results $ which cd /usr/bin/cd Additional info: ================= In RHEL 7,8 and 9) ------------------- The buffer is 256 in which.c static char home[256]; static char cwd[256]; static char result[256];