View Issue Details

IDProjectCategoryView StatusLast Update
0000256file[All Projects] Generalpublic2021-04-19 18:38
ReportermutableVoidAssigned Tochristos 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.40 
Target VersionFixed in Version5.41 
Summary0000256: Wrong file type for file with one-bit char before new-line
Description
When I execute `file` on a file that contains only a single (one-byte) character before the newline which terminates the file, the reported file type is binary instead of Unicode text (see section: Steps to reproduce).

This messes which programs like `more`, which therefore refuse to print the file's content, as the reported file type is binary.

I encountered this in the following scenario:

```bash
> printf 'h\n' > file2
> more file2
 
******** file2: Not a text file ********

> od -x file2
0000000 0a68
0000002
```

When I fill the file with a character that takes more than a single byte in Unicode, the problem does not occur:
```bash
printf 'รค\n' > new_file
file new_file
new_file: Unicode text, UTF-8 text
```
 
Steps To Reproduce```bash
printf 'h\n' > new_file
file new_file
```
prints
`new_file: data` instead of the expected `new_file: Unicode text, UTF-8 text`
TagsNo tags attached.

Activities

mutableVoid

2021-04-02 19:03

reporter   ~0003582

Might be related to the fix of bugs.astron.com/view.php?id=180 , printing the same character multiple times also reports `binary` instead of UTF-8 text:

printf 'aa\n' > new_file
file new_file
new_file: data

christos

2021-04-19 18:38

manager   ~0003590

Fixed, thanks!

Issue History

Date Modified Username Field Change
2021-04-02 18:41 mutableVoid New Issue
2021-04-02 19:03 mutableVoid Note Added: 0003582
2021-04-19 18:38 christos Assigned To => christos
2021-04-19 18:38 christos Status new => assigned
2021-04-19 18:38 christos Status assigned => resolved
2021-04-19 18:38 christos Resolution open => fixed
2021-04-19 18:38 christos Fixed in Version => 5.41
2021-04-19 18:38 christos Note Added: 0003590