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

Zip archives with files having phrase `makefile' in name treat them as makefiles #4419

Closed
mc-butler opened this issue Dec 13, 2022 · 23 comments
Assignees
Labels
area: config Configuration INI files prio: low Minor problem or easily worked around ver: 4.8.30 Reproducible in version 4.8.30
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/4419
Reporter cieply (worker@….pl)

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.

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by cieply (worker@….pl) on Dec 13, 2022 at 1:33 UTC

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 13, 2022 at 18:50 UTC (comment 1)

  • Component changed from mc-vfs to mc-core
  • Status changed from new to accepted
  • Owner set to andrew_b

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 18, 2022 at 11:46 UTC (comment 2)

Branch: 4419_makefile_regex
[7230269]

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 18, 2022 at 11:47 UTC (comment 3)

  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.29

@mc-butler
Copy link
Author

Changed by cieply (worker@….pl) on Dec 22, 2022 at 20:55 UTC (comment 4)

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.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 23, 2022 at 10:03 UTC (comment 4.5)

Replying to cieply:

I found analogical cases to those with .pdfs

What do you mean exactly?

@mc-butler
Copy link
Author

Changed by cieply (worker@….pl) on Dec 23, 2022 at 11:28 UTC (comment 5.6)

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.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 23, 2022 at 13:17 UTC (comment 6.7)

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.

@mc-butler
Copy link
Author

Changed by cieply (worker@….pl) on Dec 23, 2022 at 16:08 UTC (comment 7.8)

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.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Dec 23, 2022 at 17:17 UTC (comment 9)

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.

@mc-butler
Copy link
Author

Changed by cieply (worker@….pl) on Dec 23, 2022 at 17:22 UTC (comment 9.10)

We will try to make a new release over the holidays

It was a digression. I put it in right thread (#4357).

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.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 30, 2022 at 5:05 UTC (comment 11)

  • Votes set to andrew_b
  • Branch state changed from on review to approved

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 30, 2022 at 5:07 UTC (comment 12)

  • Votes changed from andrew_b to committed-master
  • Status changed from accepted to testing
  • Branch state changed from approved to merged
  • Resolution set to fixed

Merged to master: [995b61d].

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Dec 30, 2022 at 5:08 UTC (comment 13)

  • Status changed from testing to closed

@mc-butler
Copy link
Author

Changed by cieply (worker@….pl) on Sep 26, 2023 at 21:22 UTC (comment 14)

  • Priority changed from major to minor
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 4.8.28 to 4.8.30

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)

ENTER

Parameter
Enter parameters

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.

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Sep 30, 2023 at 18:36 UTC (comment 15)

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].

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 7, 2023 at 12:10 UTC (comment 16)

  • Component changed from mc-core to mc-config-ini

Branch: 4419_mc.ext.ini_makefile
[372cb29]

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 7, 2023 at 12:11 UTC (comment 17)

  • Branch state changed from merged to on review
  • Votes committed-master deleted

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Oct 8, 2023 at 13:12 UTC (comment 18)

  • Branch state changed from on review to approved
  • Votes set to zyv

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Oct 8, 2023 at 15:56 UTC (comment 19)

  • Branch state changed from approved to merged
  • Status changed from reopened to closed
  • Votes changed from zyv to committed-master
  • Resolution set to fixed

Merged to master: [3e44333].

@mc-butler
Copy link
Author

Changed by ossi (@ossilator) on Feb 7, 2025 at 14:23 UTC (comment 20)

the regex was intentionally loose, to match Makefile.in and such.

the problem is part of a bigger topic, currently discussed in #4128.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Feb 7, 2025 at 15:26 UTC (comment 21)

Created new ticket - #4649.

@mc-butler
Copy link
Author

Changed by zaytsev (@zyv) on Feb 22, 2025 at 11:48 UTC

  • Blocked by set to #4649

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config Configuration INI files prio: low Minor problem or easily worked around ver: 4.8.30 Reproducible in version 4.8.30
Development

No branches or pull requests

2 participants