[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-recutils] Recfix crashes
From: |
Michał Masłowski |
Subject: |
Re: [bug-recutils] Recfix crashes |
Date: |
Sat, 04 Aug 2012 17:13:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
> Recfix crashes when presented with this file:
>
> %rec: Residence
> %typedef: Nation_t enum Britain France Germany
> %key: Id
>
> Address: 10 Downing Street
> + Whitehall
> Id: 1
The patch below fixes this. It's available on the fix-other-type branch
of git://elderthing.mtjm.eu/mtjm-recutils.git.
From 80b61a86497de1204266af92d97fa61fa7aba64b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= <address@hidden>
Date: Sat, 4 Aug 2012 17:07:11 +0200
Subject: [PATCH] src,torture: fix a recfix crash reported by John Darrington.
---
ChangeLog | 9 +++++++++
src/rec-rset.c | 2 +-
torture/utils/recfix.sh | 14 ++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index c1c816c..0a4c2a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-08-04 Michał Masłowski <address@hidden>
+
+ src,torture: fix a recfix crash reported by John Darrington.
+ * src/rec-rset.c (rec_rset_get_field_type): Don't call
+ rec_type_reg_get with NULL as type name.
+
+ * torture/utils/recfix.sh (unused-type): New input file.
+ (recfix-unused-type): New test.
+
2012-08-01 Jose E. Marchesi <address@hidden>
rec-mode: copy/kill fields and records commands.
diff --git a/src/rec-rset.c b/src/rec-rset.c
index f3b56dd..1d211df 100644
--- a/src/rec-rset.c
+++ b/src/rec-rset.c
@@ -661,7 +661,7 @@ rec_rset_get_field_type (rec_rset_t rset,
if (props)
{
type = props->type;
- if (!type)
+ if (!type && props->type_name)
{
type = rec_type_reg_get (rset->type_reg, props->type_name);
}
diff --git a/torture/utils/recfix.sh b/torture/utils/recfix.sh
index c981180..2e0dde6 100755
--- a/torture/utils/recfix.sh
+++ b/torture/utils/recfix.sh
@@ -1217,6 +1217,14 @@ Id: 2
Status: Open
'
+test_declare_input_file unused-type \
+'%rec: Task
+%typedef: Status_t enum Open Closed
+%key: Id
+
+Id: 1
+'
+
#
# Declare tests.
#
@@ -2147,6 +2155,12 @@ test_tool recfix-constraint-sex-with-violation xfail \
'--check' \
constraint-sex-with-violation
+test_tool recfix-unused-type ok \
+ recfix \
+ '--check' \
+ unused-type \
+ ''
+
#
# Cleanup.
#
--
1.7.11.3
pgprKtGmv4764.pgp
Description: PGP signature