Bug#762829: file: Pascal modules (ISO 10206) wrongly classified as text/x-ruby

2016-07-22 Thread Peter
Hi,
I realise now I was not subscribed to the bug, so format/linkage of this
reply might be a bit of a mess. Sorry!


> To improve the situation without breaking detection of other text
> file types, I need a fine selection of typical pascal programs. Not
> necessarily a big number but a huge variety in style.

The compiler test files might be useful here...

FPC
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/

GPC
https://github.com/hebisch/gpc/tree/master/p/test



Regards,
Peter



Bug#762829: file: Pascal modules (ISO 10206) wrongly classified as text/x-ruby

2016-07-22 Thread Peter
On 16/07/16 23:28, Christoph Biedl wrote:
> tags 762829 confirmed upstream help
> thanks
> 
> It's been a while but it hasn't been forgotten ...
> 
> Peter wrote...
> 
>> Some Pascal source files are classified as Ruby.
>> Maybe file is confused by the keywords 'module', 'import' and export,
>> which are valid Pascal extension keywords in ISO 10206?
> 
> Correct, the "module" keyword in the first line of your example
> triggers one of the tests for ruby (magic/Magdir/ruby:25).
> 
> However I'm reluctant to change this as it easily might create
> false-positives. If there's is a distinct rule to tell Ruby and
> Pascal apart, I'll happily forward it to upstream.
> 
> Christoph
> 

Hi Christoph,

Thanks for looking at this. I'm afraid I know very little about Ruby.

Pascal files often have semicolons at the end of some lines, and the
final line is often "end."

The Ruby code I have looked at on http://rosettacode.org never has
semicolons at the end of lines and the final "end" does not have a
period after it.

This suggests two tests that could separate Ruby & Pascal.

Regards,
Peter



Bug#762829: file: Pascal modules (ISO 10206) wrongly classified as text/x-ruby

2016-07-17 Thread Christoph Biedl
Christoph Biedl wrote...

> tags 762829 help

Refining this: The detection of Pascal programs in file is a mess.
To improve the situation without breaking detection of other text
file types, I need a fine selection of typical pascal programs. Not
necessarily a big number but a huge variety in style. The second is
the problem, else I'd just pick some random packages from Debian
written in Pascal.

Christoph



signature.asc
Description: Digital signature


Bug#762829: file: Pascal modules (ISO 10206) wrongly classified as text/x-ruby

2016-07-16 Thread Christoph Biedl
tags 762829 confirmed upstream help
thanks

It's been a while but it hasn't been forgotten ...

Peter wrote...

> Some Pascal source files are classified as Ruby.
> Maybe file is confused by the keywords 'module', 'import' and export,
> which are valid Pascal extension keywords in ISO 10206?

Correct, the "module" keyword in the first line of your example
triggers one of the tests for ruby (magic/Magdir/ruby:25).

However I'm reluctant to change this as it easily might create
false-positives. If there's is a distinct rule to tell Ruby and
Pascal apart, I'll happily forward it to upstream.

Christoph


signature.asc
Description: Digital signature


Bug#762829: file: Pascal modules (ISO 10206) wrongly classified as text/x-ruby

2014-09-25 Thread Peter
Package: file
Version: 1:5.19-2
Severity: normal

Dear Maintainer,

Some Pascal source files are classified as Ruby.
Maybe file is confused by the keywords 'module', 'import' and export,
which are valid Pascal extension keywords in ISO 10206?

A short example is attached.


-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=aa_DJ.utf8, LC_CTYPE=aa_DJ.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages file depends on:
ii  libc6  2.19-11
ii  libmagic1  1:5.19-2
ii  zlib1g 1:1.2.8.dfsg-2

file recommends no packages.

file suggests no packages.

-- no debconf information

module Out4m;
(* FLAG --extended-pascal *)

export emil23m = (OK);

procedure OK;

end;

import StandardOutput;

procedure OK;
begin
  WriteLn ('OK')
end;

end.