Ticket #4419 (closed defect: fixed)
Zip archives with files having phrase `makefile' in name treat them as makefiles
Reported by: | cieply | Owned by: | andrew_b |
---|---|---|---|
Priority: | minor | Milestone: | 4.8.29 |
Component: | mc-config-ini | Version: | 4.8.30 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description
I found this issue recently.
Zip archives with files having phrase `makefile' in name treat them as makefiles and upon enter mc tries to read paramaters for makefile and execute it.
I attached few samples.
Just try to enter/view them and you will see.
Even worse it is with compressed pdfs. They don't even need to use `.pdf' extension, they will be picked up anyway. Trying to view zipped pdf ends up with error window "Syntax Warning: May not be a PDF file (continuing anyway)" and one cannot view nor enter it. All one can do is to manually unzip it end then it can be read.
Example:
wget https://sun.aei.polsl.pl/~sdeor/corpus/reymont.bz2 bzip2 -dk reymont.bz2 zip reymont.zip reymont
These shouldn't work like that. One should be able to enter to zip archive and view it if they want, not to be treated like scripts.
Attachments
Change History
comment:1 Changed 21 months ago by andrew_b
- Status changed from new to accepted
- Owner set to andrew_b
- Component changed from mc-vfs to mc-core
comment:2 Changed 21 months ago by andrew_b
Branch: 4419_makefile_regex
changeset:7230269ce41676c41a988c8625c6517e8ffeab74
comment:3 Changed 21 months ago by andrew_b
- Branch state changed from no branch to on review
- Milestone changed from Future Releases to 4.8.29
comment:4 follow-up: ↓ 5 Changed 21 months ago by cieply
I have checked that patch and it seems to work but I found analogical cases to those with .pdfs. Whenever you pack .pdf or .webm or .1/.2/.[0-9], or .jpg/.png/.gif/.bmp/.pnm/any image, same thing happens. I guess it has nothing to do with a suffix and everything with a recognized extension. Zip, rar, 7z, tar, whatever archive should not automatically execute any file in it in any case.
comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 21 months ago by cieply
I found analogical cases to those with .pdfs
What do you mean exactly?
I said about pdfs in a first post. It happens with other extensions as well. If there is a file, with known suffix and is zipped then on enter it will be executed. It might make sens with .gz, .bz2, etc. but not with multi file archives like tar, zip, rar.
cp /usr/man/man1/cmp.1 cmp.1 zip m1.zip cmp.1 cp /usr/man/man1/cmp.1 cmp.1 cp /usr/man/man1/clear.1 clear.1 zip m2.zip cmp.1 clear.1 cp /usr/man/man1/cmp.1 cmp.1 cp /usr/man/man1/clear.1 clear.1 echo aaa > aaa.txt echo zzz > zzz.txt zip m3.zip cmp.1 clear.1 aaa.txt zzz.txt
Now you can't enter these archives. Instead they get "executed". what is executed? Some external, gui unarchiver in my case, which I don't necessarily want to use, using mc. You can't even view contents with F3. You get an error: <standard input>:2: warning: can't find character with input code 3
Same with files like pdfs, images, and so on.
zip img1.zip a.bmp zip img2.zip a.bmp b.bmp
Sometimes if you add more files it stops doing that.
zip m5.zip /usr/man/man5/*
But in any way, it wasn't the case before.
comment:7 in reply to: ↑ 6 ; follow-up: ↓ 8 Changed 21 months ago by andrew_b
Replying to cieply:
Now you can't enter these archives. Instead they get "executed". what is executed? Some external, gui unarchiver in my case, which I don't necessarily want to use, using mc. You can't even view contents with F3. You get an error: <standard input>:2: warning: can't find character with input code 3
Everything fine for me. I can enter to these archives.
In #4141 format of mc.ext was changed and mc.ext parser was rewritten. Such behaviour was fixed too.
comment:8 in reply to: ↑ 7 Changed 21 months ago by cieply
Everything fine for me. I can enter to these archives.
Not for me though.
In #4141 format of mc.ext was changed and mc.ext parser was rewritten. Such behaviour was fixed too.
Well, there is only 4.8.28 available for download.
How can I fix it then?
BTW. if changes are so deep, why won't you call new version 4.9? Maybe keeping build count. That would be 4.9.29. Major version and then minor are more important than "build" or whatever you call the last number.
comment:9 follow-up: ↓ 10 Changed 21 months ago by zaytsev
We will try to make a new release over the holidays. It's long due, but very unfortunately, I was not able to find time to support andrew_b so far. Had to deal with some unexpected infra migration in the time allocated for release instead.
comment:10 in reply to: ↑ 9 Changed 21 months ago by cieply
We will try to make a new release over the holidays
It was a digression. I put it in right thread.
I wondered how to fix it, not when a new release is going to be.
I tried to compare diff with 4.8.16 but it didn't help me in finding it.
comment:11 Changed 21 months ago by andrew_b
- Votes for changeset set to andrew_b
- Branch state changed from on review to approved
comment:12 Changed 21 months ago by andrew_b
- Status changed from accepted to testing
- Votes for changeset changed from andrew_b to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [995b61db9ebf3e2b9dde26cfeb406d111c1d5033].
comment:14 Changed 12 months ago by cieply
- Status changed from closed to reopened
- Priority changed from major to minor
- Version changed from 4.8.28 to 4.8.30
- Resolution fixed deleted
Wanted to bump this issue as version 4.8.30 still has this problem. Although constructions like 'blabla-makefile' are not a problem anymore, 'makefile' or 'makefile...blabla' are.
FN=Makefile echo \# > $FN zip $FN.zip $FN FN=Makefile.blabla echo \# > $FN zip $FN.zip $FN FN=makefile echo \# > $FN zip $FN.zip $FN
F3
Cannot open "/path/to/Makefile-1.zip" in parse mode Operation not supported (95)
Also noticed that rar and 7z have no issue with these names.
rar a Makefile.rar Makefile 7z a Makefile.7z Makefile
Wonder whether it has something to do with uzip.
comment:15 Changed 11 months ago by andrew_b
Makefile. makefile and Makefile.zip are handled with following section in mc.ext.ini:
792 [Makefile] 793 Regex=^[Mm]akefile 794 Open=make -f %f %{Enter parameters}
Regex=^[Mm]akefile means that file name begins with Makefile or makefile. Makefile.zip is matched to that.
Fix is handle of Makefile as whole word:
Regex=^[Mm]akefile$
Makefile.zip isn't handled as zip-file because sections [zip-by-shell] and [zip-by-type] are below [Makefile].
comment:16 Changed 11 months ago by andrew_b
- Component changed from mc-core to mc-config-ini
Branch: 4419_mc.ext.ini_makefile
changeset:372cb29d80e13f48a3ab67417fa89e305c5a7f5f
comment:17 Changed 11 months ago by andrew_b
- Votes for changeset committed-master deleted
- Branch state changed from merged to on review
comment:18 Changed 11 months ago by zaytsev
- Votes for changeset set to zyv
- Branch state changed from on review to approved
comment:19 Changed 11 months ago by andrew_b
- Status changed from reopened to closed
- Votes for changeset changed from zyv to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [3e4433377635e0f6cb315817af9da0a73c00b7bf].