FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 05-20-2008, 07:29 PM
"Dan McGee"
 
Default Use "--mime" instead of file's "-i" parameter, to increase portability

On Tue, May 20, 2008 at 12:51 PM, Sebastian Nowicki <sebnow@gmail.com> wrote:
> The equivalent of the "-i" argument for file on Linux is "-I" on BSD.
> Both version allow the use of the long option "--mime".
>
> Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
> ---
This seems fine, but the Arch manpage we have for file is from the BSD
General Commands Manual and documents both -i and --mime. I do see
that it is a 2008 revision, so perhaps older BSDs do not have the -i
option. Seems OK otherwise- Xavier, feel free to queue this up if you
are OK with it.

> scripts/makepkg.sh.in | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 9da3687..ce5ac3f 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -606,7 +606,7 @@ extract_sources() {
> fi
>
> # fix flyspray #6246
> - local file_type=$(file -bizL "$file")
> + local file_type=$(file -bzL --mime "$file")
> local cmd='
> case "$file_type" in
> *application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
> --
> 1.5.4.5
>
>
> _______________________________________________
> pacman-dev mailing list
> pacman-dev@archlinux.org
> http://archlinux.org/mailman/listinfo/pacman-dev
>

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-20-2008, 11:01 PM
Xavier
 
Default Use "--mime" instead of file's "-i" parameter, to increase portability

On Tue, May 20, 2008 at 9:29 PM, Dan McGee <dpmcgee@gmail.com> wrote:
> On Tue, May 20, 2008 at 12:51 PM, Sebastian Nowicki <sebnow@gmail.com> wrote:
>> The equivalent of the "-i" argument for file on Linux is "-I" on BSD.
>> Both version allow the use of the long option "--mime".
>>
>> Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
>> ---
> This seems fine, but the Arch manpage we have for file is from the BSD
> General Commands Manual and documents both -i and --mime. I do see
> that it is a 2008 revision, so perhaps older BSDs do not have the -i
> option. Seems OK otherwise- Xavier, feel free to queue this up if you
> are OK with it.
>

That parameter naming difference looks very stupid to me, but well,
that is a simple workaround so I am ok with it.

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-26-2008, 06:24 AM
Sebastian Nowicki
 
Default Use "--mime" instead of file's "-i" parameter, to increase portability

On 26/05/2008, at 12:08 AM, Xavier wrote:

> Sebastian Nowicki wrote:
>> The equivalent of the "-i" argument for file on Linux is "-I" on BSD.
>> Both version allow the use of the long option "--mime".
>>
>
> I checked freebsd and netbsd man pages, both seem to use -i as well.
> I could not check openbsd one, the page is unavailable.
> Where can we find other (older?) bsd man pages?


I thought I sent a mail about that earlier, but I guess it didn't go
through. -I is used on Mac OSX. When sending the patch I thought I
checked that this was the case in other BSD man pages, but I must have
confused that with something else.

From the Mac OSX (Leopard 1.5) man page:
> -I, --mime
> Causes the file command to output mime type strings rather
> than
> the more traditional human readable ones. Thus it may
> say
> ``text/plain; charset=us-ascii' rather than ``ASCII
> text'.
> In order for this option to work, file changes the way it
> han-
> dles files recognised by the command itself (such as many
> of
> the text file types, directories etc), and makes use of
> an
> alternative ``magic' file. (See ``FILES' section, below).
>
> -i If the file is a regular file do not classify its contents.


You can find the online copy here: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/file.1.html

I just looked through it again and it appears there's a "legacy"
section, which does use the lower case -i…

--
Sebastian Nowicki


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-26-2008, 10:47 AM
Sebastian Nowicki
 
Default Use "--mime" instead of file's "-i" parameter, to increase portability

On 26/05/2008, at 2:38 PM, Xavier wrote:

> I was fine with this change because it thought it was needed for every
> BSD platform, but seeing it is just a mac osx change almost makes me
> want to reconsider.

I thought it was a more worthwhile patch as well.

> And if you just use COMMAND_MODE=legacy to restore the normal
> interface,
> this patch is no longer needed?

Yes, it works:
> > COMMAND_MODE=legacy file -bziL libfetch-6.2.0.0.tar.bz2
> application/x-tar (application/x-bzip2)

Some change to the code would still be required though, like setting
the environment variable. I don't think it would be very elegant to
require the user to set the environment variable.

--
Sebastian Nowicki


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-26-2008, 11:04 AM
Xavier
 
Default Use "--mime" instead of file's "-i" parameter, to increase portability

On Mon, May 26, 2008 at 12:47 PM, Sebastian Nowicki <sebnow@gmail.com> wrote:
>
> On 26/05/2008, at 2:38 PM, Xavier wrote:
>
>> I was fine with this change because it thought it was needed for every
>> BSD platform, but seeing it is just a mac osx change almost makes me
>> want to reconsider.
>
> I thought it was a more worthwhile patch as well.
>
>> And if you just use COMMAND_MODE=legacy to restore the normal
>> interface,
>> this patch is no longer needed?
>
> Yes, it works:
>> > COMMAND_MODE=legacy file -bziL libfetch-6.2.0.0.tar.bz2
>> application/x-tar (application/x-bzip2)
>
> Some change to the code would still be required though, like setting
> the environment variable. I don't think it would be very elegant to
> require the user to set the environment variable.
>

Well maybe I would prefer this solution, adding this somewhere in makepkg :
export COMMAND_MODE=legacy
Can you confirm it works that way too?

I think it would also be safer. For instance, you forgot the second file call.
But also in the future if these file commands are modified or new ones
are added, it would be better to just have the above export. Though I
suppose this env var is only used by macos and would have no influence
on other systems, right?
So as always, some testing would be appreciated before we put this in makepkg

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-27-2008, 09:20 AM
Sebastian Nowicki
 
Default Use "--mime" instead of file's "-i" parameter, to increase portability

On 26/05/2008, at 7:04 PM, Xavier wrote:

> Well maybe I would prefer this solution, adding this somewhere in
> makepkg :
> export COMMAND_MODE=legacy
> Can you confirm it works that way too?
>
> I think it would also be safer. For instance, you forgot the second
> file call.
> But also in the future if these file commands are modified or new ones
> are added, it would be better to just have the above export. Though I
> suppose this env var is only used by macos and would have no influence
> on other systems, right?
> So as always, some testing would be appreciated before we put this
> in makepkg


I'm currently testing makepkg with exported COMMAND_MODE=legacy, and
it seems to be working fine, but I'll test it a bit more and send a
patch later in the day. I was looking into COMMAND_MODE a bit more,
and found something that is a bit bazaar. It appears that OSX's
current utilities conform to the UNIX 03 specification. So OSX is more
UNIX compliant than BSD and Linux… that's a bit surprising.

From http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/compat.5.html

> Setting the environment variable COMMAND_MODE to the value legacy
> causes utility programs to behave as closely to Mac OS X 10.3's
> utility programs as possible. When in this mode all of 10.3's flags
> are accepted, and in some cases extra flags are accepted, but no
> flags that were used in 10.3 will have been removed or changed in
> meaning. Any behavioral changes in this mode are documented in the
> LEGACY sections of the individual utilities.

>

> Setting the environment variable COMMAND_MODE to the value unix03
> causes utility programs to obey the Version 3 of the Single UNIX
> Specification (``SUSv3') standards even if doing so would alter the
> behavior of flags used in 10.3.

>

> The value of COMMAND_MODE is case insensitive and if it is unset or
> set to something other than legacy or unix03 it behaves as if it
> were set to unix03.


The change to file and other utilities are probably new to Leopard,
since that's when OSX got UNIX certification.

--
Sebastian Nowicki


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 07:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org