Comment # 3 on bug 1225197 from Dirk Mueller
it doesn't actually use the magic "features" for anything other than refusing
to show a file if it is considered binary. 

here's the code in question: 

/* check_magic -- check for file magic numbers. */
static int check_magic(struct more_control *ctl, char *fs)
{
#ifdef HAVE_MAGIC
⇥       const int fd = fileno(ctl->current_file);
⇥       const char *mime_encoding = magic_descriptor(ctl->magic, fd);
⇥       const char *magic_error_msg = magic_error(ctl->magic);

⇥       if (magic_error_msg) {
⇥       ⇥       printf("%s: %s: %s\n", program_invocation_short_name,
⇥       ⇥       ⇥       _("magic failed"), magic_error_msg);
⇥       ⇥       return 0;
⇥       }
⇥       if (!mime_encoding || !(strcmp("binary", mime_encoding))) {
⇥       ⇥       printf(_("\n******** %s: Not a text file ********\n\n"), fs);
⇥       ⇥       return 1;
⇥       }
#else
⇥       signed char twobytes[2];

⇥       /* don't try to look ahead if the input is unseekable */
⇥       if (fseek(ctl->current_file, 0L, SEEK_SET))
⇥       ⇥       return 0;               

⇥       if (fread(twobytes, 2, 1, ctl->current_file) == 1) {
⇥       ⇥       switch (twobytes[0] + (twobytes[1] << 8)) {
⇥       ⇥       case 0407:⇥     /* a.out obj */
⇥       ⇥       case 0410:⇥     /* a.out exec */
⇥       ⇥       case 0413:⇥     /* a.out demand exec */
⇥       ⇥       case 0405:
⇥       ⇥       case 0411:
⇥       ⇥       case 0177545:
⇥       ⇥       case 0x457f:⇥   /* simple ELF detection */
⇥       ⇥       ⇥       printf(_("\n******** %s: Not a text file
********\n\n"),
⇥       ⇥       ⇥              fs);
⇥       ⇥       ⇥       return 1;
⇥       ⇥       }
⇥       }
⇥       fseek(ctl->current_file, 0L, SEEK_SET);⇥/* rewind() not necessary */
#endif
⇥       return 0;


so it does implement the same feature without it, just maybe in a less correct
way. but it could easily be extended should there be a regression report coming
in.


You are receiving this mail because: