Skip to content

Commit

Permalink
Merge fix-1908305 branch into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
anjohnson committed Feb 27, 2021
2 parents 12ab694 + 08eaea6 commit 7f878d3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
14 changes: 14 additions & 0 deletions documentation/RELEASE_NOTES.md
Expand Up @@ -18,6 +18,20 @@ should also be read to understand what has changed since earlier releases.
<!-- Insert new items immediately below here ... -->


### Prevent default DTYPs from changing

[Kay Kasemir reported](https://bugs.launchpad.net/epics-base/+bug/1908305) that
it is possible to change the Base record type's default DTYP if a `device()`
entry is seen before the `recordtype()` definition to which it refers. The
default DTYP is the first device loaded, which is normally the `Soft Channel`
support from Base. A warning was being displayed by dbdExpand when a `device()`
entry was see first, but that was easily missed.

The DBD file parser in dbdExpand.pl has now been modified to make this an error,
although the registerRecordDeviceDriver.pl script will still accept `device()`
entries without having their `recordtype()` loaded since this is necessary to
compile device supports as loadable modules.


### Priority inversion safe Posix mutexes

Expand Down
@@ -1,2 +1,2 @@
include "xxxRecord.dbd"
device(xxx,CONSTANT,devXxxSoft,"SoftChannel")
device(xxx,CONSTANT,devXxxSoft,"Soft Channel")
6 changes: 5 additions & 1 deletion modules/database/src/tools/DBD/Parser.pm
Expand Up @@ -29,6 +29,7 @@ use DBD::Function;
use DBD::Variable;

our $debug=0;
our $allowAutoDeclarations=0;

sub ParseDBD {
(my $dbd, $_) = @_;
Expand Down Expand Up @@ -102,8 +103,11 @@ sub ParseDBD {
unquote($1, $2, $3, $4);
my $rtyp = $dbd->recordtype($record_type);
if (!defined $rtyp) {
my $msg = "Device '$choice' refers to unknown record type '$record_type'.";
dieContext($msg, "DBD files must be combined in the correct order.")
unless $allowAutoDeclarations;
warn "$msg\nRecord type '$record_type' declared.\n";
$rtyp = DBD::Recordtype->new($record_type);
warn "Device using unknown record type '$record_type', declaration created\n";
$dbd->add($rtyp);
}
$rtyp->add_device(DBD::Device->new($link_type, $dset, $choice));
Expand Down
3 changes: 3 additions & 0 deletions modules/database/src/tools/registerRecordDeviceDriver.pl
Expand Up @@ -31,6 +31,9 @@

my ($file, $subname, $bldTop) = @ARGV;

# Auto-declaration of record types is needed to build loadable modules
$DBD::Parser::allowAutoDeclarations = 1;

my $dbd = DBD->new();
ParseDBD($dbd, Readfile($file, "", \@path));

Expand Down

0 comments on commit 7f878d3

Please sign in to comment.