Bug 411259 - Preview opens scripts as binary files
Summary: Preview opens scripts as binary files
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 19.04.3
Platform: Slackware Linux
: NOR minor
Target Milestone: ---
Assignee: Elvis Angelaccio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-25 04:43 UTC by Chris
Modified: 2020-12-16 15:28 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2019-08-25 04:43:09 UTC
SUMMARY
This is a new behavior, not sure when it started happening, but it was not to long ago. After opening compressed source files and selecting for example "configure" or "setup.py" to view the contents, the preview is opened with a binary viewer instead with a text viewer. In the past Ark always opened as text. I have noted this with any file the starts with "#!" but not always. It appears that file extension may also used to determine how to open such files.

STEPS TO REPRODUCE Using ark-19.04.3-tar.xz
1. Open a compressed file that has scripts in it.
2. Click on a script file to preview it. 

OBSERVED RESULT
File is previewed with a binary viewer.

EXPECTED RESULT
File is previewed with a text viewer (as it has in the past).

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Slackware64-current Kernel: 4.19.67 
(available in About System)
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.61.0
Qt Version: 5.13.0

ADDITIONAL INFORMATION
None
Comment 1 Todd 2019-08-29 16:39:52 UTC
I can confirm the same issue with all python scripts on openSUSE Tumbleweed:

Ark Version 19.08.0
KDE Frameworks 5.61.0
Qt 5.13.0 (built against 5.13.0)
Comment 2 Méven Car 2019-10-23 11:56:21 UTC
I don't reproduce it with the file ark-19.08.0.tar.xz found at https://download.kde.org/stable/applications/19.08.0/src/ark-19.08.0.tar.xz

Previewing file Messages.sh inside works at expected.

Operating System: Kubuntu 19.10
KDE Plasma Version: 5.17.80
KDE Frameworks Version: 5.64.0
Qt Version: 5.12.4

Does the issue still reproduce with a more recent version of KDE Frameworks and/or ark ?
Comment 3 Chris 2019-10-26 13:05:17 UTC
(In reply to Méven Car from comment #2)
> I don't reproduce it with the file ark-19.08.0.tar.xz found at
> https://download.kde.org/stable/applications/19.08.0/src/ark-19.08.0.tar.xz
> 
> Previewing file Messages.sh inside works at expected.
> 
> Operating System: Kubuntu 19.10
> KDE Plasma Version: 5.17.80
> KDE Frameworks Version: 5.64.0
> Qt Version: 5.12.4
> 
> Does the issue still reproduce with a more recent version of KDE Frameworks
> and/or ark ?

Operating System: Slackware64-current
KDE Plasma Version: 5.17.0
KDE Frameworks Version: 5.63.0
Qt Version: 5.13.1
Kernel Version: 4.19.80
Ark Version: 19.08.2

I can still reproduce With the above.
Comment 4 Chris 2020-01-04 03:15:32 UTC
Operating System: Slackware64-current
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.2
Kernel Version: 5.4.7
Ark Version 19.12.0

This problem still exist.
Comment 5 Chris 2020-03-25 14:21:01 UTC
I this issue ever going to be fixed?

Operating System: Slackware64-current
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.68.0
Qt Version: 5.13.2
Kernel Version: 5.4.27
Ark Version 19.12.3
Comment 6 Christoph Feck 2020-04-15 18:44:03 UTC
Cannot reproduce either with a sample tar.gz that contains an executable bash script, even if it is marked +x and called *.sh. It is opened KWrite (my configured text viewer).
Comment 7 Chris 2020-04-27 09:16:44 UTC
(In reply to Christoph Feck from comment #6)
> Cannot reproduce either with a sample tar.gz that contains an executable
> bash script, even if it is marked +x and called *.sh. It is opened KWrite
> (my configured text viewer).

When I open a tarball that has a bash script in it. It does not what the extension is. Example using the latest claws-mail-3.17.5.tar.xz found from their download site. The tarball has a autogen.sh and a configure in the root of the tarball. Opening either of those files results in Ark opening them as a binary file. It does not matter if the file is executable or not. I have tested both same result. It's quite possible that something is keying in on the shebang "#!". There was a point in the past where bash scripts were opened properly as a text preview. For example opening claws-features.h is the same tarball opens as preview text. I frequently open source code tarballs before compiling to review the compile scripts.
Comment 8 Méven Car 2020-04-27 13:43:11 UTC
If two people cannot reproduce, it probably is due to a state / particular setting on your system.

My guess would be that somehow ark does not get the mimetype for those files (the binary viewer is used to open application/octet-stream mimetype which is the default one).
Comment 9 Chris 2020-06-29 09:19:53 UTC
Well this problem still exist for me. When using preview it opens as a binary. When selecting open, it opens correctly.

(In reply to Méven Car from comment #8)
> If two people cannot reproduce, it probably is due to a state / particular
> setting on your system.
> 
> My guess would be that somehow ark does not get the mimetype for those files
> (the binary viewer is used to open application/octet-stream mimetype which
> is the default one).
 In settings File Associations application/octet-stream there in nothing set under. 

I am open to suggestions on where to look, it could very well be in setting somewhere. This has worked properly in the past. I do a lot of work with Ark and source scripts, opening and reading files so this issue is very annoying. Thanks.
Comment 10 Méven Car 2020-06-29 14:46:07 UTC
(In reply to Chris from comment #9)
> Well this problem still exist for me. When using preview it opens as a
> binary. When selecting open, it opens correctly.
> 
> (In reply to Méven Car from comment #8)
> > If two people cannot reproduce, it probably is due to a state / particular
> > setting on your system.
> > 
> > My guess would be that somehow ark does not get the mimetype for those files
> > (the binary viewer is used to open application/octet-stream mimetype which
> > is the default one).
>  In settings File Associations application/octet-stream there in nothing set
> under. 

That does not matter.

The issue is that the mimetype resolution for file preview fails for scripts and returns default application/octet-stream which is opened with a binary editor.
That or the file association or definition for bash files is not set up properly on your system.

> 
> I am open to suggestions on where to look, it could very well be in setting
> somewhere. This has worked properly in the past. I do a lot of work with Ark
> and source scripts, opening and reading files so this issue is very
> annoying. Thanks.

Try checking the mime type file association with text bash files (x-shellscript).
And system's "x-shellscript" MIME definition :
"grep x-shellscript /usr/share/mime/packages/*"

On my system I get:
/usr/share/mime/packages/freedesktop.org.xml:    <sub-class-of type="application/x-shellscript"/>
/usr/share/mime/packages/freedesktop.org.xml:  <mime-type type="application/x-shellscript">
Comment 11 Chris 2020-06-30 13:35:13 UTC
(In reply to Méven Car from comment #10)
> That or the file association or definition for bash files is not set up
> properly on your system.
> 
It is setup properly. Opening bash scripts works as expected except with Ark's Preview option. If I select Open, Kate is opened as it should be.

> > 
> > I am open to suggestions on where to look, it could very well be in setting
> > somewhere. This has worked properly in the past. I do a lot of work with Ark
> > and source scripts, opening and reading files so this issue is very
> > annoying. Thanks.
> 
> Try checking the mime type file association with text bash files
> (x-shellscript).
> And system's "x-shellscript" MIME definition :
> "grep x-shellscript /usr/share/mime/packages/*"
> 
> On my system I get:
> /usr/share/mime/packages/freedesktop.org.xml:    <sub-class-of
> type="application/x-shellscript"/>
> /usr/share/mime/packages/freedesktop.org.xml:  <mime-type
> type="application/x-shellscript">

Thanks for the help. I get the same results on my system.

root@racermach:~# grep x-shellscript /usr/share/mime/packages/*
/usr/share/mime/packages/freedesktop.org.xml:    <sub-class-of type="application/x-shellscript"/>
/usr/share/mime/packages/freedesktop.org.xml:  <mime-type type="application/x-shellscript">
Comment 12 Justin Zobel 2020-12-01 08:09:51 UTC
Please provide a sample file where this occurs. That way we can ensure we are testing with the same set of data.

I've set the bug status to "needsinfo" pending your response, please change back to "reported" or "resolved" when you respond, thanks.
Comment 13 Bug Janitor Service 2020-12-16 04:34:04 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 14 Chris 2020-12-16 14:53:44 UTC
(In reply to Bug Janitor Service from comment #13)
> Dear Bug Submitter,
> 
> This bug has been in NEEDSINFO status with no change for at least
> 15 days. Please provide the requested information as soon as
> possible and set the bug status as REPORTED. Due to regular bug
> tracker maintenance, if the bug is still in NEEDSINFO status with
> no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
> due to lack of needed information.
> 
> For more information about our bug triaging procedures please read the
> wiki located here:
> https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging
> 
> If you have already provided the requested information, please
> mark the bug as REPORTED so that the KDE team knows that the bug is
> ready to be confirmed.
> 
> Thank you for helping us make KDE software even better for everyone!

Sorry about the slow response. I didn't release it has been so long. Thanks for the reminder email. 

Operating System: Slackware64-current
KDE Plasma Version: 5.20.4
KDE Frameworks Version: 5.77.0
Qt Version: 5.15.2
Kernel Version: 5.4.83
OS Type: 64-bit
Processors: 4 × AMD Phenom(tm) II X4 840 Processor
Memory: 7.8 GiB of RAM
Graphics Processor: GeForce GT 730/PCIe/SSE2

Ark Version 20.12.0

I have tried opening (Preview) several bash scripts in various archive from Ark. All are now acting correctly, opening (Preview) Kate instead of a binary viewer. 

It appears somewhere along the way this issue has been fixed. As you can see from my version list above, compared to my last post. There have been many upgrades. So as far as I am conserned the issue is been resolved.



Again sorry for the late input on this. Also thanks for keeping up on this, I had pretty much given up with this being resolved.
Comment 15 Méven Car 2020-12-16 15:28:59 UTC
(In reply to Chris from comment #14)
> (In reply to Bug Janitor Service from comment #13)
> > Dear Bug Submitter,
> > 
> > This bug has been in NEEDSINFO status with no change for at least
> > 15 days. Please provide the requested information as soon as
> > possible and set the bug status as REPORTED. Due to regular bug
> > tracker maintenance, if the bug is still in NEEDSINFO status with
> > no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
> > due to lack of needed information.
> > 
> > For more information about our bug triaging procedures please read the
> > wiki located here:
> > https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging
> > 
> > If you have already provided the requested information, please
> > mark the bug as REPORTED so that the KDE team knows that the bug is
> > ready to be confirmed.
> > 
> > Thank you for helping us make KDE software even better for everyone!
> 
> Sorry about the slow response. I didn't release it has been so long. Thanks
> for the reminder email. 
> 
> Operating System: Slackware64-current
> KDE Plasma Version: 5.20.4
> KDE Frameworks Version: 5.77.0
> Qt Version: 5.15.2
> Kernel Version: 5.4.83
> OS Type: 64-bit
> Processors: 4 × AMD Phenom(tm) II X4 840 Processor
> Memory: 7.8 GiB of RAM
> Graphics Processor: GeForce GT 730/PCIe/SSE2
> 
> Ark Version 20.12.0
> 
> I have tried opening (Preview) several bash scripts in various archive from
> Ark. All are now acting correctly, opening (Preview) Kate instead of a
> binary viewer. 
> 
> It appears somewhere along the way this issue has been fixed. As you can see
> from my version list above, compared to my last post. There have been many
> upgrades. So as far as I am concerned the issue is been resolved.
> 

I am very glad.

> If two people cannot reproduce, it probably is due to a state / particular setting on your system.

Given how behind your versions were, we could have just considered the bug as fixed because non-reproducible by two other people.

> 
> 
> Again sorry for the late input on this. Also thanks for keeping up on this,
> I had pretty much given up with this being resolved.

Thanks for keeping us posted, no worries.