Bug 192534 - Syntax error in checkkey.sh
Summary: Syntax error in checkkey.sh
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Books & Articles (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Warren Block
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-09 20:37 UTC by Enji Cooper
Modified: 2014-08-26 20:04 UTC (History)
1 user (show)

See Also:


Attachments
Fix for the syntax error (370 bytes, patch)
2014-08-09 20:37 UTC, Enji Cooper
no flags Details | Diff
Fix for the syntax errors (864 bytes, patch)
2014-08-09 20:43 UTC, Enji Cooper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2014-08-09 20:37:01 UTC
Created attachment 145580 [details]
Fix for the syntax error

There's a syntax error in checkkey.sh :

$ bash -n checkkey.sh 
checkkey.sh: line 105: syntax error near unexpected token `;'
checkkey.sh: line 105: `			;&'

A patch is attached which fixes the syntax error.
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2014-08-09 20:43:31 UTC
Created attachment 145581 [details]
Fix for the syntax errors

Hmmm.. there are a couple more issues (I updated the patch):

./checkkey.sh: line 237: 1 \* 365 : syntax error: invalid arithmetic operator (error token is "\* 365 ")
Comment 2 Warren Block freebsd_committer freebsd_triage 2014-08-09 22:06:30 UTC
(In reply to yaneurabeya from comment #0)
> Created attachment 145580 [details]
> Fix for the syntax error
> 
> There's a syntax error in checkkey.sh :
> 
> $ bash -n checkkey.sh 
> checkkey.sh: line 105: syntax error near unexpected token `;'
> checkkey.sh: line 105: `			;&'
> 
> A patch is attached which fixes the syntax error.

This is not a syntax error on genuine sh(1):

     If the selected list is terminated by the control operator `;&' instead of
     `;;', execution continues with the next list, continuing until a list termi-
     nated with `;;' or the end of the case command.
Comment 3 Enji Cooper freebsd_committer freebsd_triage 2014-08-11 01:39:30 UTC
(In reply to Warren Block from comment #2)

...

> This is not a syntax error on genuine sh(1):
> 
>      If the selected list is terminated by the control operator `;&' instead
> of
>      `;;', execution continues with the next list, continuing until a list
> termi-
>      nated with `;;' or the end of the case command.

Hmmm... didn't realize that, and the docs didn't mention that I needed to run checkkey.sh on FreeBSD :/. I can submit a portable sh patch.
Comment 4 Warren Block freebsd_committer freebsd_triage 2014-08-11 22:11:57 UTC
Actually, bash(1) says ;& is valid.  bash -n (bash-4.3.22) has no complaints with it after the two backslash escapes are removed.
Comment 5 commit-hook freebsd_committer freebsd_triage 2014-08-11 22:15:02 UTC
A commit references this bug:

Author: wblock
Date: Mon Aug 11 22:14:36 UTC 2014
New revision: 45437
URL: http://svnweb.freebsd.org/changeset/doc/45437

Log:
  Un-escape two asterisks to improve compatibility with bash.

  PR:		192534
  Submitted by:	yaneurabeya@gmail.com

Changes:
  head/share/pgpkeys/checkkey.sh
Comment 6 Warren Block freebsd_committer freebsd_triage 2014-08-26 20:04:17 UTC
checkkey.sh is part of the doc repository, so no MFC is needed.