Bug 1480778

Summary: Tree doesn't display non-ASCII correctly
Product: [Fedora] Fedora Reporter: Göran Uddeborg <goeran>
Component: treeAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: kdudka, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tree-1.7.0-11.fc27 tree-1.7.0-11.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-18 00:26:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Göran Uddeborg 2017-08-11 20:59:47 UTC
Description of problem:
If there are non-ASCII characters in a file or directory name, these are displayed as octal codes by tree.  This happens even in an UTF-8 locale.  (In the C locale it is expected.)


Version-Release number of selected component (if applicable):
tree-1.7.0-8.fc26.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. mkdir -p tmp/åäö
2. tree tmp


Actual results:
tmp
└── \303\245\303\244\303\266


Expected results:
tmp
└── åäö


Additional info:
This is a packaging issue.  Upstreams "tree" handles it correctly.  But the make command in the spec file overrides the CFLAGS setting in the Makefile, breaking this.  Combining the two placing this command in the spec file will create a correct "tree" command.

make CFLAGS="$RPM_OPT_FLAGS $(getconf LFS_CFLAGS) -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" %{?_smp_mflags}

Comment 1 Kamil Dudka 2017-08-14 08:43:05 UTC
Thank you for reporting the bug!  It should be fixed by the following commit:

commit dc38b66fd0b300e0ea18d3731ecb772e325d618b (HEAD -> refs/remotes/origin/master, refs/remotes/origin/f26, refs/remotes/origin/HEAD)
Author: Kamil Dudka <kdudka@...>
Date:   Mon, 14 Aug 2017 10:29:15 +0200

    Resolves: #1480778 - do not escape UTF-8 chars in file names by default in UTF-8 locale

diff --git a/tree.spec b/tree.spec
index d3d2316..b569172 100644
--- a/tree.spec
+++ b/tree.spec
@@ -27,6 +27,9 @@ utility.
 %prep
 %autosetup -p1

+# do not escape UTF-8 chars in file names by default in UTF-8 locale (#1480778)
+sed -e 's/LINUX/__linux__/' -i tree.c
+
 %build
 make CFLAGS="$RPM_OPT_FLAGS $(getconf LFS_CFLAGS)" %{?_smp_mflags}

@@ -46,6 +49,7 @@ chmod -x $RPM_BUILD_ROOT%{_mandir}/man1/tree.1

 %changelog
 * Mon Aug 14 2017 Kamil Dudka <kdudka> - 1.7.0-11
+- do not escape UTF-8 chars in file names by default in UTF-8 locale (#1480778)
 - modernize spec file (Group, BuildRoot, autosetup, clean, defattr)

 * Thu Aug 03 2017 Fedora Release Engineering <releng> - 1.7.0-10


I wanted to put just a reference to that commit but Pagure gives me 404 on https://src.fedoraproject.org/rpms/tree :-/

Comment 2 Fedora Update System 2017-08-14 08:48:39 UTC
tree-1.7.0-11.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-a4e9eee1d3

Comment 3 Fedora Update System 2017-08-15 06:23:10 UTC
tree-1.7.0-11.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-a4e9eee1d3

Comment 4 Fedora Update System 2017-08-18 00:26:24 UTC
tree-1.7.0-11.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.