PHP zip extension broken with libzip

2017-05-15 Thread Joni Eskelinen
This has been a long standing bug, but i just recently sought out the cause.

The following snippets fails in currently packaged php:
open("test.zip", ZipArchive::CREATE | ZipArchive::OVERWRITE);
$zip->addFromString("foo.txt", "foo");
$zip->close();

With a warning:
Warning: ZipArchive::close(): Renaming temporary file failed: Illegal
seek in /tmp/zip.php on line 5

It appears that the problem lies in libzip. If the extension is built
without `--with-libzip=/usr`, the error doesn't emerge. When libzip is
not available, extension is built with a bundled zip implementation.

To test, navigating into `ext/zip` in php source.

Test with bundled library:
phpize && LDFLAGS='-lpcre' ./configure && make test

Test with libzip:
phpize && LDFLAGS='-lpcre' ./configure --with-libzip=/usr && make test

Latter produces 19 failed tests.

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: [ANNOUNCEMENT] New: cygextreg-1.2.0-1

2017-05-09 Thread Joni Eskelinen
On 10.5.2017 0.48, Andrey Repin wrote:
> Greetings, Joni Eskelinen!
> 
>> On 5.5.2017 14.17, Andrey Repin wrote:
>>> Greetings, Joni Eskelinen!
>>>
>>>> The following package has been added to the Cygwin distribution:
>>>
>>>> * cygextreg-1.2.0-1
>>>
>>>
>>>> Scripts are executed with bash
>>>
>>> This must not be the case, unless explicitly requested. Enough that
>>> all Windows associations are executed with cmd if you try to
>>> CreateProcess blindly. Don't copy this mistake.
>>>
>> Bash is used as an intermediary shell that executes the script.
>> Generally a shebang line denotes the actual interpreter.
> 
>> Bash was chosen because it's bundled with a default Cygwin installation.
> 
> /usr/bin/env is also in the default install.
> And I'm using it to run scripts now.
> See attached TCC wrapper.
> 
Thanks for the pointers! I'll have a look if there's any added benefit.

>>> If you want to make it useful, write a thin wrapper over exec() that
>>> finds out and runs proper interpreter, and support it with options to
>>> make interpreters happy. F.e. convert $0 to Cygwin path, if
>>> interpreter don't understand native paths (i.e. dash cringe over
>>> non-latin1 native paths and I yet to find out why).
>>>
>> All native paths are converted to Cygwin equivalents before invoking
>> bash,
> 
> That's not the right thing to do. You can't know if a "path" you convert is an
> actual local filesystem path (except for $0, but even then, it is not always
> necessary).
> 
Arguments are tested whether they're local paths and only then converted.

>> ie. $0 as in the path of the file that was clicked from Windows,
>> and consecutive arguments if some files were dragged and dropped to
>> registered file icon.
>> That is, the script shall always receive only Posix style paths, by design.
> 
> You have a strangely limited perception on the usability of your tool.
> How about console invocation?
> 
Sorry but i fail to see your point. The whole rationale of this tool is
to avoid console, to provide simple point and click interface for users
to invoke shell scripts.

>>>> in an interactive login shell.
>>>
>>> This should be optional. Login shell may cause $(pwd) to change, not 
>>> to mention, it alters environment.
>>>
>>>> If the executed script exits with a non-zero code, MinTTY window
>>>
>>> This should be optional.
>>>
>>>> shall be kept open
>>>
>>> This should be optional.
>>>
>> Nice suggestions. I've thought to implement per extension options
>> especially for keeping the window open after completion.
> 
>> Script is actually invoked roughly as follows:
>> /bin/bash -il -c 'cd  && ./'
> 
> So, you're intentionally changing execution environment?
> 
Yes exactly. This is by design.
Typical use case is that a script performs something in its containing
diretory, ie. compile or generate something relative to its location.

>> with proper escaping applied. So even though user's personal init script
>> changes the working directory, the script will be invoked in its
>> containing directory.
> 
> Which is not necessarily the place where user had it invoked.
> 
Not necessarily but generally yes, script's directory is always the
place it has been invoked. This is the case when you double click it
from Explorer or drag & drop something to it.
If one has more specific needs, then there's the usual tools to
accomplish that.

>> I think it's a reasonable default to have bash run this way, since
>> there's a fair chance that scripts require environmental variables set
>> in .bashrc or like (eg. $PATH to ruby gems).
> 
> I'm not in the favor of chances when I'm doing my work.
> 
There's no way to make everyone happy, isn't there? :) Luckily this tool
is open for forking and i welcome you to open suggestions at
https://github.com/sop/cygextreg/issues.

- Joni

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Re: [ANNOUNCEMENT] New: cygextreg-1.2.0-1

2017-05-09 Thread Joni Eskelinen
On 5.5.2017 14.17, Andrey Repin wrote:
> Greetings, Joni Eskelinen!
> 
>> The following package has been added to the Cygwin distribution:
> 
>> * cygextreg-1.2.0-1
> 
> 
>> Scripts are executed with bash
> 
> This must not be the case, unless explicitly requested. Enough that
> all Windows associations are executed with cmd if you try to
> CreateProcess blindly. Don't copy this mistake.
> 
Bash is used as an intermediary shell that executes the script.
Generally a shebang line denotes the actual interpreter.

Bash was chosen because it's bundled with a default Cygwin installation.

> If you want to make it useful, write a thin wrapper over exec() that
> finds out and runs proper interpreter, and support it with options to
> make interpreters happy. F.e. convert $0 to Cygwin path, if
> interpreter don't understand native paths (i.e. dash cringe over
> non-latin1 native paths and I yet to find out why).
> 
All native paths are converted to Cygwin equivalents before invoking
bash, ie. $0 as in the path of the file that was clicked from Windows,
and consecutive arguments if some files were dragged and dropped to
registered file icon.
That is, the script shall always receive only Posix style paths, by design.

>> in an interactive login shell.
> 
> This should be optional. Login shell may cause $(pwd) to change, not 
> to mention, it alters environment.
> 
>> If the executed script exits with a non-zero code, MinTTY window
> 
> This should be optional.
> 
>> shall be kept open
> 
> This should be optional.
> 
Nice suggestions. I've thought to implement per extension options
especially for keeping the window open after completion.

Script is actually invoked roughly as follows:
/bin/bash -il -c 'cd  && ./'
with proper escaping applied. So even though user's personal init script
changes the working directory, the script will be invoked in its
containing directory.
I think it's a reasonable default to have bash run this way, since
there's a fair chance that scripts require environmental variables set
in .bashrc or like (eg. $PATH to ruby gems).

- Joni

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



[ANNOUNCEMENT] New: cygextreg-1.2.0-1

2017-05-04 Thread Joni Eskelinen
The following package has been added to the Cygwin distribution:

* cygextreg-1.2.0-1

CygExtReg is a utility program allowing to register an extension (eg.
.sh) to be executed in Cygwin by double-clicking a file from Windows
File Explorer or by dragging and dropping files to an icon of a
registered extension.

https://github.com/sop/cygextreg

-- 
Joni

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



New: cygextreg-1.2.0-1

2017-05-04 Thread Joni Eskelinen
The following package has been added to the Cygwin distribution:

* cygextreg-1.2.0-1

CygExtReg is a utility program allowing to register an extension (eg.
.sh) to be executed in Cygwin by double-clicking a file from Windows
File Explorer or by dragging and dropping files to an icon of a
registered extension.

https://github.com/sop/cygextreg

-- 
Joni


Requesting upload privileges

2017-05-03 Thread Joni Eskelinen
Name: Joni Eskelinen
Package: cygextreg
 BEGIN SSH2 PUBLIC KEY 
B3NzaC1yc2EDAQABAAABAQC7Oubl8eZs+KRHTl+yVtwiR4VBJfdA22sr6z9kxw
lkW1yq1QtIcLtD8GDcWCdZ4dTLij4ErGz58I/ppwsAfg4cfFDQInFFyS9o2+cNDSJ/sHN2
orni26TtBVx5YBkapIAFpD98IAtztA7NEuZ+Vl28EfZl5Kys/epFdkRlggN7YXictTkGl/
1x8eEAi6CH2aJPZWAu9xwnyhBfwdwNaIix8CZB/q/nwBHdHGt+mkv/N40phjvnh32y1FQr
hb8Ix1wXipHp+4YVUJMCO5lNQrshbm7eD2vdsQot4fKKHYOxx1AbbG1Z+SLr8XgjMaMtyo
/EGgqxXQPneiHogxsySYRr
 END SSH2 PUBLIC KEY 





signature.asc
Description: OpenPGP digital signature


Re: [ITP] cygregext (formerly cygscript)

2017-05-03 Thread Joni Eskelinen
On 29.4.2017 14.54, Jon Turney wrote:
> On 28/04/2017 21:46, Eric Blake wrote:
>> On 04/28/2017 03:08 AM, Joni Eskelinen wrote:
>>> Hi all,
>>
>>> I've renamed cygscript as proposed. Hopefully cygregext conveys its
>>> purpose more clearly. A man page has also been added.
>>
>> My first read was 'cygwin regular-expressions t'.  Maybe a slight tweak
>> to cygextreg (for cygwin extension registration) keeps the same length
>> but with less confusion with an already well-used abbreviation?
> 
> This makes sense to me, but it's your choice.
> 
Thanks for your input. I've renamed the command to cygextreg, hopefully
for the last time for now :). TBH i wasn't really happy with the ring of
'regex' in cygregext, so this is definitely better.

>>>>> Nice work.  I'm kind of surprised we don't have something like this
>>>>> already.
>>>>
>>
>>>>>> This application is not included in any other distro, so i reckon
>>>>>> a vote
>>>>>> must be first passed.
>>>>>
>>>>> +1
>>
>> At any rate, I'm also +1 for inclusion, whether or not you take my
>> naming suggestion.
> 
> Please provide a ssh key as per https://cygwin.com/package-upload.html
> 
I'll proceed with a request.


Re: [ITP] cygregext (formerly cygscript)

2017-04-28 Thread Joni Eskelinen
Hi all,

I've renamed cygscript as proposed. Hopefully cygregext conveys its
purpose more clearly. A man page has also been added.

Repository has been moved to https://github.com/sop/cygregext.
Packages are available for inspection at http://eske.fi/cygregext/.

On 20.4.2017 8.24, Joni Eskelinen wrote:
> On 19.4.2017 20.00, Jon Turney wrote:
>> On 30/03/2017 06:54, Joni Eskelinen wrote:
>>> Dear maintainers,
>>>
>>> Cygscript is an utility program allowing to register file types to be
>>> executed in Cygwin when double clicked from File Explorer or when a file
>>> is dragged and dropped to a registered file type.
>>>
>>> Any file type can be registered. Scripts are executed with bash in
>>> MinTTY terminal. Windows paths passed as arguments (eg. when dragged and
>>> dropped) are automatically detected and translated to POSIX paths.
>>
>> Thank you for your patience and sorry about the delay.
>>
>> Nice work.  I'm kind of surprised we don't have something like this
>> already.
> 
> Thanks! I'm surprised too, since there's a lot of kinda hackish Windows
> batch file solutions that are not generic nor easy to install.
> TBH i'd rather see this feature implemented as a part of MinTTY.
> 
>> How attached are you to the name?  I know this is not a concept which
>> lends itself easily to a short name, but perhaps something which makes
>> the purpose a little more obvious is possible?
> 
> I settled on cygscript after a few iterations, but it's trivial to
> change at this point. It's hard to come up with something that is not
> bulky. Although this not a command one has to type often, so it wouldn't
> matter if it had a longer name. I'd gladly hear suggestions.
> 
>>> Please see the github page for further details.
>>
>> It would be nice if there was a manpage included in the package.
> 
> I'll write and bundle a manpage in the near future.
> 
>>> This application is not included in any other distro, so i reckon a vote
>>> must be first passed.
>>
>> +1
>>
>>>
>>> I am the sole developer and maintainer of the project at the moment.
>>>
>>> The source is released under MIT License.
>>>
>>> Homepage:
>>> https://github.com/sop/cygscript
>>>
>>> Packages:
>>> http://eske.fi/cygscript/
>>>
>>> # cygscript-1.0.2-1.hint
>>> category: Utils
>>> requires: cygwin libgcc1 libstdc++6 mintty bash
>>> sdesc: "Run shell scripts from Windows File Explorer"
>>> ldesc: "A helper program allowing to register an extension (eg. .sh)
>>> to be executed in Cygwin by double-clicking a file from Windows File
>>> Explorer
>>> or by dragging and dropping files to an icon of a registered extension."


Re: [ITP] cygscript

2017-04-19 Thread Joni Eskelinen
On 19.4.2017 20.00, Jon Turney wrote:
> On 30/03/2017 06:54, Joni Eskelinen wrote:
>> Dear maintainers,
>>
>> Cygscript is an utility program allowing to register file types to be
>> executed in Cygwin when double clicked from File Explorer or when a file
>> is dragged and dropped to a registered file type.
>>
>> Any file type can be registered. Scripts are executed with bash in
>> MinTTY terminal. Windows paths passed as arguments (eg. when dragged and
>> dropped) are automatically detected and translated to POSIX paths.
> 
> Thank you for your patience and sorry about the delay.
> 
> Nice work.  I'm kind of surprised we don't have something like this
> already.

Thanks! I'm surprised too, since there's a lot of kinda hackish Windows
batch file solutions that are not generic nor easy to install.
TBH i'd rather see this feature implemented as a part of MinTTY.

> How attached are you to the name?  I know this is not a concept which
> lends itself easily to a short name, but perhaps something which makes
> the purpose a little more obvious is possible?

I settled on cygscript after a few iterations, but it's trivial to
change at this point. It's hard to come up with something that is not
bulky. Although this not a command one has to type often, so it wouldn't
matter if it had a longer name. I'd gladly hear suggestions.

>> Please see the github page for further details.
> 
> It would be nice if there was a manpage included in the package.

I'll write and bundle a manpage in the near future.

>> This application is not included in any other distro, so i reckon a vote
>> must be first passed.
> 
> +1
> 
>>
>> I am the sole developer and maintainer of the project at the moment.
>>
>> The source is released under MIT License.
>>
>> Homepage:
>> https://github.com/sop/cygscript
>>
>> Packages:
>> http://eske.fi/cygscript/
>>
>> # cygscript-1.0.2-1.hint
>> category: Utils
>> requires: cygwin libgcc1 libstdc++6 mintty bash
>> sdesc: "Run shell scripts from Windows File Explorer"
>> ldesc: "A helper program allowing to register an extension (eg. .sh)
>> to be executed in Cygwin by double-clicking a file from Windows File
>> Explorer
>> or by dragging and dropping files to an icon of a registered extension."


[ITP] cygscript

2017-03-29 Thread Joni Eskelinen
Dear maintainers,

Cygscript is an utility program allowing to register file types to be
executed in Cygwin when double clicked from File Explorer or when a file
is dragged and dropped to a registered file type.

Any file type can be registered. Scripts are executed with bash in
MinTTY terminal. Windows paths passed as arguments (eg. when dragged and
dropped) are automatically detected and translated to POSIX paths.
Please see the github page for further details.

This application is not included in any other distro, so i reckon a vote
must be first passed.

I am the sole developer and maintainer of the project at the moment.

The source is released under MIT License.

Homepage:
https://github.com/sop/cygscript

Packages:
http://eske.fi/cygscript/

# cygscript-1.0.2-1.hint
category: Utils
requires: cygwin libgcc1 libstdc++6 mintty bash
sdesc: "Run shell scripts from Windows File Explorer"
ldesc: "A helper program allowing to register an extension (eg. .sh)
to be executed in Cygwin by double-clicking a file from Windows File
Explorer
or by dragging and dropping files to an icon of a registered extension."

Thanks,
  Joni