public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
@ 2023-07-29 20:55 yak_ex
  2023-07-30 12:27 ` Jon Turney
  2023-07-30 18:31 ` ASSI
  0 siblings, 2 replies; 11+ messages in thread
From: yak_ex @ 2023-07-29 20:55 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

Hi maintainers,

This is my first post here.
The attached tiny patch fixes incorrect options passed to unzstd in unpack()
in lib/src_prep.cygpart.

`unpack()` invokes `unzstd` for a *.zst file as
`unzstd -qo file.zst`
Then, an error occurs as 'stdin is a console, aborting',
because the `-o` option is to specify an output file name.

There are some choices to fix it. This patch aligns with handling .gz
and .bz2 like
`unzstd -c file.zst > file`.

Regards,
Yasutaka ATARASHI
---
Yasutaka ATARASHI <yak1ex@gmail.com>

[-- Attachment #2: src_prep_unpack.patch --]
[-- Type: application/octet-stream, Size: 336 bytes --]

--- lib/src_prep.cygpart.orig	2023-07-29 17:00:50.409163400 +0900
+++ lib/src_prep.cygpart	2023-07-29 17:01:16.683974800 +0900
@@ -138,7 +138,8 @@
 				;;
 			*.zst)
 				check_prog_req zstd;
-				unpack_cmd="unzstd -qo";
+				unpack_cmd="unzstd -c";
+				unpack_out="${unpack_file_name%.zst}";
 				;;
 			*.7z)
 				if check_prog 7zr

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-07-29 20:55 [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack() yak_ex
@ 2023-07-30 12:27 ` Jon Turney
  2023-08-04 17:51   ` ASSI
  2023-07-30 18:31 ` ASSI
  1 sibling, 1 reply; 11+ messages in thread
From: Jon Turney @ 2023-07-30 12:27 UTC (permalink / raw)
  To: cygwin-apps, Yasutaka ATARASHI

On 29/07/2023 21:55, yak_ex via Cygwin-apps wrote:
> Hi maintainers,
> 
> This is my first post here.
> The attached tiny patch fixes incorrect options passed to unzstd in unpack()
> in lib/src_prep.cygpart.
> 
> `unpack()` invokes `unzstd` for a *.zst file as
> `unzstd -qo file.zst`
> Then, an error occurs as 'stdin is a console, aborting',
> because the `-o` option is to specify an output file name.
> 
> There are some choices to fix it. This patch aligns with handling .gz
> and .bz2 like
> `unzstd -c file.zst > file`.

Thanks very much.

Do you have an example of a cygport which fails without this fix, so I 
can add a test for this?


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-07-29 20:55 [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack() yak_ex
  2023-07-30 12:27 ` Jon Turney
@ 2023-07-30 18:31 ` ASSI
  2023-08-04 17:28   ` Yasutaka ATARASHI
  1 sibling, 1 reply; 11+ messages in thread
From: ASSI @ 2023-07-30 18:31 UTC (permalink / raw)
  To: cygwin-apps

yak_ex via Cygwin-apps writes:
> `unpack()` invokes `unzstd` for a *.zst file as
> `unzstd -qo file.zst`
> Then, an error occurs as 'stdin is a console, aborting',
> because the `-o` option is to specify an output file name.

Indeed, sorry for that.

> There are some choices to fix it. This patch aligns with handling .gz
> and .bz2 like
> `unzstd -c file.zst > file`.

Hmm. I'd would have preferred to use the --keep option (which is the
default for unzstd anyway) and save the redirection (also for the other
programs that offer that option).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-07-30 18:31 ` ASSI
@ 2023-08-04 17:28   ` Yasutaka ATARASHI
  2023-08-04 18:14     ` ASSI
  0 siblings, 1 reply; 11+ messages in thread
From: Yasutaka ATARASHI @ 2023-08-04 17:28 UTC (permalink / raw)
  Cc: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

Sorry for the late reply.

I updated the patch to handle the case of .xz, also, and a bit
adjusted the arguments of `check_prog_req`.

Jon Turney writes:
>Do you have an example of a cygport which fails without this fix, so I
>can add a test for this?

My motivating example is far from the minimum, so I made a tiny
example from the base-cygwin package. Without the attached patch, the
case of test.patch.{gz,bz2} works, on the other hand, the case of
test.patch.{xz,zst} fails.
Not only .zst, but also .xz fails.
This is because `cygpatch()` condiers *.xz files but `unpack()` can't
handle *.xz files except for *.tar.xz.

ASSI via Cygwin-apps writes:
> Hmm. I'd would have preferred to use the --keep option (which is the
> default for unzstd anyway) and save the redirection (also for the other
> programs that offer that option).

Yeah, I also wonder why the --keep option is not used for .gz and .bz2.
Now, I recognized the reason.
`unpack()` is expected to extract the files to the current working
directory regardless of the specified path of the input. Please see
the usage in `__src_prep()`.
Therefore, --keep option can't be used simply.

Regards,
Yasutaka ATARASHI

[-- Attachment #2: src_prep_unpack_rev2.patch --]
[-- Type: application/octet-stream, Size: 543 bytes --]

--- lib/src_prep.cygpart.orig	2023-07-29 17:00:50.409163400 +0900
+++ lib/src_prep.cygpart	2023-08-05 02:08:17.013524200 +0900
@@ -136,9 +136,15 @@
 				check_prog_req unzip;
 				unpack_cmd="unzip -oq";
 				;;
+			*.xz)
+				check_prog_req unxz xz;
+				unpack_cmd="unxz -c";
+				unpack_out="${unpack_file_name%.xz}";
+				;;
 			*.zst)
-				check_prog_req zstd;
-				unpack_cmd="unzstd -qo";
+				check_prog_req unzstd zstd;
+				unpack_cmd="unzstd -c";
+				unpack_out="${unpack_file_name%.zst}";
 				;;
 			*.7z)
 				if check_prog 7zr

[-- Attachment #3: example.tar.xz --]
[-- Type: application/octet-stream, Size: 2724 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-07-30 12:27 ` Jon Turney
@ 2023-08-04 17:51   ` ASSI
  2023-08-07 16:54     ` Jon Turney
  0 siblings, 1 reply; 11+ messages in thread
From: ASSI @ 2023-08-04 17:51 UTC (permalink / raw)
  To: cygwin-apps

Jon Turney via Cygwin-apps writes:
> Do you have an example of a cygport which fails without this fix, so I
> can add a test for this?

Anything with a SRC_URI or PATCH_URI that has .zst suffix but not
.tar.zst should suffice.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-08-04 17:28   ` Yasutaka ATARASHI
@ 2023-08-04 18:14     ` ASSI
  2023-08-04 18:39       ` Yasutaka ATARASHI
  0 siblings, 1 reply; 11+ messages in thread
From: ASSI @ 2023-08-04 18:14 UTC (permalink / raw)
  To: cygwin-apps

Yasutaka ATARASHI via Cygwin-apps writes:
> Yeah, I also wonder why the --keep option is not used for .gz and .bz2.
> Now, I recognized the reason.

Thanks.

> `unpack()` is expected to extract the files to the current working
> directory regardless of the specified path of the input. Please see
> the usage in `__src_prep()`.
> Therefore, --keep option can't be used simply.

That's true for bunzip2 and gunzip, but not for zstd (where the output
file can be independently specified).


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-08-04 18:14     ` ASSI
@ 2023-08-04 18:39       ` Yasutaka ATARASHI
  2023-08-07 16:54         ` Jon Turney
  0 siblings, 1 reply; 11+ messages in thread
From: Yasutaka ATARASHI @ 2023-08-04 18:39 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

ASSI via Cygwin-apps writes:
> That's true for bunzip2 and gunzip, but not for zstd (where the output
> file can be independently specified).

Ah ha. The attached patch recovers to use the `-o` option for `unzstd`.

Regards,
Yasutaka ATARASHI

[-- Attachment #2: src_prep_unpack_rev3.patch --]
[-- Type: application/octet-stream, Size: 525 bytes --]

--- lib/src_prep.cygpart.orig	2023-07-29 17:00:50.409163400 +0900
+++ lib/src_prep.cygpart	2023-08-05 03:25:20.953130600 +0900
@@ -136,9 +136,14 @@
 				check_prog_req unzip;
 				unpack_cmd="unzip -oq";
 				;;
+			*.xz)
+				check_prog_req unxz xz;
+				unpack_cmd="unxz -c";
+				unpack_out="${unpack_file_name%.xz}";
+				;;
 			*.zst)
-				check_prog_req zstd;
-				unpack_cmd="unzstd -qo";
+				check_prog_req unzstd zstd;
+				unpack_cmd="unzstd -qo ${unpack_file_name%.zst}";
 				;;
 			*.7z)
 				if check_prog 7zr

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-08-04 18:39       ` Yasutaka ATARASHI
@ 2023-08-07 16:54         ` Jon Turney
  0 siblings, 0 replies; 11+ messages in thread
From: Jon Turney @ 2023-08-07 16:54 UTC (permalink / raw)
  To: Yasutaka ATARASHI, cygwin-apps

On 04/08/2023 19:39, Yasutaka ATARASHI via Cygwin-apps wrote:
> ASSI via Cygwin-apps writes:
>> That's true for bunzip2 and gunzip, but not for zstd (where the output
>> file can be independently specified).
> 
> Ah ha. The attached patch recovers to use the `-o` option for `unzstd`.

Thanks. I applied this.

I added '-f' as that seems to be needed to ensure 'cygport prep' works 
when run a second time.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-08-04 17:51   ` ASSI
@ 2023-08-07 16:54     ` Jon Turney
  2023-08-07 17:28       ` ASSI
  0 siblings, 1 reply; 11+ messages in thread
From: Jon Turney @ 2023-08-07 16:54 UTC (permalink / raw)
  To: cygwin-apps

On 04/08/2023 18:51, ASSI via Cygwin-apps wrote:
> Jon Turney via Cygwin-apps writes:
>> Do you have an example of a cygport which fails without this fix, so I
>> can add a test for this?
> 
> Anything with a SRC_URI or PATCH_URI that has .zst suffix but not
> .tar.zst should suffice.
> 

Yes, I had managed to deduce that much. :)

Providing a specific instance would save me having to find or invent 
one, though.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
  2023-08-07 16:54     ` Jon Turney
@ 2023-08-07 17:28       ` ASSI
  0 siblings, 0 replies; 11+ messages in thread
From: ASSI @ 2023-08-07 17:28 UTC (permalink / raw)
  To: cygwin-apps

Jon Turney via Cygwin-apps writes:
> Yes, I had managed to deduce that much. :)
>
> Providing a specific instance would save me having to find or invent
> one, though.

Sorry, I did not have one at hand, all such instances in my stack of
packages are either uncompressed files or compressed archives.  Which
might explain why it took so long to discover this bug.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack()
@ 2023-07-29  8:23 Yasutaka ATARASHI
  0 siblings, 0 replies; 11+ messages in thread
From: Yasutaka ATARASHI @ 2023-07-29  8:23 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

Hi, maintainers.

The attached tiny patch fixes incorrect options passed to unzstd in unpack()
in lib/src_prep.cygpart.

unpack() in lib/src_prep.cygpart calls unzstd for a *.zst file as
`unzstd -qo file.zst`
Then, an error occurrs as 'stdin is a console, aborting'.

There are some choices to fix it, this patch aligns with handling .gz and .bz2.

-- 
Yasutaka ATARASHI <atara-y@mx.scn.tv>

[-- Attachment #2: src_prep_unpack.patch --]
[-- Type: application/octet-stream, Size: 336 bytes --]

--- lib/src_prep.cygpart.orig	2023-07-29 17:00:50.409163400 +0900
+++ lib/src_prep.cygpart	2023-07-29 17:01:16.683974800 +0900
@@ -138,7 +138,8 @@
 				;;
 			*.zst)
 				check_prog_req zstd;
-				unpack_cmd="unzstd -qo";
+				unpack_cmd="unzstd -c";
+				unpack_out="${unpack_file_name%.zst}";
 				;;
 			*.7z)
 				if check_prog 7zr

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-08-07 17:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-29 20:55 [PATCH cygport] lib/src_prep.cygpart: Fix incorrect options passed to unzstd in unpack() yak_ex
2023-07-30 12:27 ` Jon Turney
2023-08-04 17:51   ` ASSI
2023-08-07 16:54     ` Jon Turney
2023-08-07 17:28       ` ASSI
2023-07-30 18:31 ` ASSI
2023-08-04 17:28   ` Yasutaka ATARASHI
2023-08-04 18:14     ` ASSI
2023-08-04 18:39       ` Yasutaka ATARASHI
2023-08-07 16:54         ` Jon Turney
  -- strict thread matches above, loose matches on Subject: below --
2023-07-29  8:23 Yasutaka ATARASHI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).