Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Incompatible behavior with ls with newlines #1072

Open
1 task done
NazarioJL opened this issue Jul 6, 2024 · 2 comments
Open
1 task done

[Bug]: Incompatible behavior with ls with newlines #1072

NazarioJL opened this issue Jul 6, 2024 · 2 comments
Assignees

Comments

@NazarioJL
Copy link

Version

  • latest

version

1.1.2

What OS are you seeing the problem on?

macOS

installation

cargo install lsd

term

xterm-256color

ls-colors

di=1;36:ln=35:so=32:pi=33:ex=31:bd=34;46:cd=34;43:su=30;41:sg=30;46:tw=30;42:ow=30;43

What happened?

When trying to count words using `wc` I am getting different output. 

Repro steps

mkdir temp
cd temp
touch {00..40}.tmp
lsd | wc
#       3      41     327
/bin/ls | wc
#       41      41     287


Expected output:
  41      41     287
Actual output:
  3      41     287

What expected?

The line count for output _should_ be consistent with `/bin/ls`

What else?

No response

@GottZ
Copy link

GottZ commented Jul 12, 2024

Same problem here.
ls uses to not make assumptions about width if it encounters the output stream is not tty

/usr/bin/lsd /dev/disk/by-id/ata-* | sed '/-part[0-9]+$/d'

/dev/disk/by-id/ata-Hitachi_HDS5C3020ALA632_ML4230FA16WWYK  /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YJNX0KC01186R        /dev/disk/by-id/ata-ST4000DM004-2CV104_ZFN105KW
/dev/disk/by-id/ata-INTENSO_DCFE07860C0B01299906-part1      /dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YJNX0KC01186R-part2  /dev/disk/by-id/ata-ST4000DM004-2CV104_ZFN105WY
/dev/disk/by-id/ata-INTENSO_DD8B07860C0B01299904-part1      /dev/disk/by-id/ata-Samsung_SSD_870_QVO_8TB_S5SSNF0W614899R          /dev/disk/by-id/ata-ST8000DM004-2CX188_ZCT0F2E7

/usr/bin/ls /dev/disk/by-id/ata-* | sed '/-part[0-9]+$/d'

/dev/disk/by-id/ata-Hitachi_HDS5C3020ALA632_ML4230FA16WWYK
/dev/disk/by-id/ata-INTENSO_DCFE07860C0B01299906
/dev/disk/by-id/ata-INTENSO_DD8B07860C0B01299904
/dev/disk/by-id/ata-Samsung_SSD_860_EVO_250GB_S3YJNX0KC01186R
/dev/disk/by-id/ata-Samsung_SSD_870_QVO_8TB_S5SSNF0W409834J
/dev/disk/by-id/ata-Samsung_SSD_870_QVO_8TB_S5SSNF0W614899R
/dev/disk/by-id/ata-ST4000DM004-2CV104_ZFN105KW
/dev/disk/by-id/ata-ST4000DM004-2CV104_ZFN105WY
/dev/disk/by-id/ata-ST8000DM004-2CX188_ZCT0F2E7

@GottZ
Copy link

GottZ commented Jul 12, 2024

same as #1052 I'd say

@GottZ GottZ mentioned this issue Jul 13, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants