Bug 55546 - [patch] cdcontrol(1) play tr m:s.f interface is partially broken
Summary: [patch] cdcontrol(1) play tr m:s.f interface is partially broken
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 4.8-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2003-08-13 15:50 UTC by Anthony Wood
Modified: 2022-10-17 12:38 UTC (History)
0 users

See Also:


Attachments
patch-cdcontrol.c.bz2 (1.60 KB, application/octet-stream)
2011-02-02 23:45 UTC, Tatsuki Makino
no flags Details
cdcontrol.patch (5.30 KB, patch)
2011-03-20 20:39 UTC, Alexander Best
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Wood 2003-08-13 15:50:07 UTC
The 'play tr m:s.f ...' interface is broken, such that cdcontrol
sometimes rejects a minute:second offset improperly, saying that
'Track x is not that long.'  Other times, when it should reject
the request (eg, 'play 12 35:0'), an Input/Output error occurs
instead.

Fix: 

The bug is in function play(), at label Play_Relative_Addresses,
where the msf.(minute|second|frame) fields taken out of toc_buffer[]
are treated as if they were the duration of each track, when in
fact they are the cumulative *start* of each track.  To convert to
duration, which is needed to range check the 'play track m:s.f'
command, something like happens in prtrack() needs to happen.
That is, pull the msf for this and the next track, convert both
to lba, subtract, and convert back to msf.

This is probably an easy bug to fix, except for the 13 different
invocation varieties allowed.
How-To-Repeat:  [Note: 5.x has a fix for a separate (track - 1) problem that is
  necessary to reproduce in exactly the way shown here.]

cdcontrol> info
Starting track = 1, ending track = 19, TOC size = 162 bytes
track     start  duration   block  length   type
-------------------------------------------------
    1   0:02.00   3:17.18       0   14793  audio
    2   3:19.18   3:54.25   14793   17575  audio
    3   7:13.43   2:43.55   32368   12280  audio
    4   9:57.23   3:40.45   44648   16545  audio
    5  13:37.68   2:03.74   61193    9299  audio
    6  15:41.67   3:06.58   70492   14008  audio
    7  18:48.50   2:25.66   84500   10941  audio
    8  21:14.41   3:09.23   95441   14198  audio
    9  24:23.64   6:36.19  109639   29719  audio
   10  31:00.08   4:56.49  139358   22249  audio
   11  35:56.57   4:48.60  161607   21660  audio
   12  40:45.42   2:43.60  183267   12285  audio
[...]
cdcontrol> play 1 0:30
Track 1 is not that long.
cdcontrol> play 11 30:00
cdcontrol: Input/output error
Comment 1 Tatsuki Makino 2011-02-02 23:45:59 UTC
This is a patch for fixing this problem.
This patch is created for CVS Revision 1.48.8.1. But it can use to 1.53. 
Comment 2 Alexander Best freebsd_committer freebsd_triage 2011-03-20 20:39:06 UTC
this issue is still present in 9.0 (r219727).

i've attached the patch again, because the initial patch didn't apply cleanly,
due to several changes made to cdcontrol since 2003 (year the initial patch was
submitted).

it would be nice somebody can take a look at this patch after all these years.

cheers.
alex

-- 
a13x
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:37 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:38:30 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>