Skip to content

Commit

Permalink
Merge 9f4f008 into 0134e4d
Browse files Browse the repository at this point in the history
  • Loading branch information
chapulina authored Jun 30, 2021
2 parents 0134e4d + 9f4f008 commit 2be745e
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 159 deletions.
29 changes: 0 additions & 29 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

23 changes: 0 additions & 23 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

92 changes: 0 additions & 92 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
issues:
types: [opened]
pull_request_target:
types: [opened]
name: Ticket opened
jobs:
assign:
name: Add ticket to inbox
runs-on: ubuntu-latest
steps:
- name: Add ticket to inbox
uses: technote-space/create-project-card-action@v1
with:
PROJECT: Core development
COLUMN: Inbox
GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }}
CHECK_ORG_PROJECT: true

8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

### libsdformat 11.X.X (202X-XX-XX)

### libsdformat 11.2.1 (2021-06-28)

1. Fix ABI break on sdf11
* [Pull request #606](https://github.com/ignitionrobotics/sdformat/pull/606)

1. Add triage, remove ticket templates
* [Pull request #608](https://github.com/ignitionrobotics/sdformat/pull/608)

### libsdformat 11.2.0 (2021-06-23)

1. Revert behavior of FilePath() for elements loaded from strings
Expand Down
14 changes: 9 additions & 5 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ forward programmatically.
This document aims to contain similar information to those files
but with improved human-readability..

## libsdformat 11.1.0 to 11.2.0

ABI was broken for `sdf::Element`, and restored on version 11.2.1.

## libsdformat 11.0.0 to 11.x.x

### Additions

1. **sdf/Console.hh** Add functions to retrieve message stream objects. These
1. **sdf/Console.hh** Add functions to retrieve message stream objects. These
can be useful for redirecting the console output to other streams.
+ ConsoleStream &GetMsgStream()
+ ConsoleStream &GetLogStream()
Expand All @@ -28,15 +32,15 @@ but with improved human-readability..

1. **test/test_utils.hh**:
+ ScopeExit: A utility struct that calls a function when going out of scope.
+ RedirectConsoleStream: A utility class used for redirecting the output of
sdferr, sdfwarn, etc to a more convenient stream object like a
+ RedirectConsoleStream: A utility class used for redirecting the output of
sdferr, sdfwarn, etc to a more convenient stream object like a
std::stringstream for testing purposes.

## libsdformat 10.x to 11.0

### Additions

1. **sdf/ParserConfig.hh** A class that contains configuration options for the
1. **sdf/ParserConfig.hh** A class that contains configuration options for the
libsdformat parser.

1. + Depend on ignition-utils1 for the ImplPtr and UniqueImplPtr.
Expand Down Expand Up @@ -92,7 +96,7 @@ but with improved human-readability..

1. Fixed Atmosphere DOM class's temperature default value. Changed from -0.065 to -0.0065.
* [Pull request 482](https://github.com/osrf/sdformat/pull/482)

1. Fixed parsing of `<sensor><pose>` tags on lumped links when converting from URDF.
* [Pull request 525](https://github.com/osrf/sdformat/pull/525)

Expand Down
12 changes: 6 additions & 6 deletions include/sdf/Element.hh
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,6 @@ namespace sdf
/// \brief True if element is required
public: std::string required;

/// \brief True if the element was set in the SDF file.
public: bool explicitlySetInFile;

/// \brief Element description
public: std::string description;

Expand Down Expand Up @@ -574,14 +571,17 @@ namespace sdf
/// \brief Path to file where this element came from
public: std::string path;

/// \brief Spec version that this was originally parsed from.
public: std::string originalVersion;

/// \brief True if the element was set in the SDF file.
public: bool explicitlySetInFile;

/// \brief Line number in file where this element came from
public: std::optional<int> lineNumber;

/// \brief XML path of this element.
public: std::string xmlPath;

/// \brief Spec version that this was originally parsed from.
public: std::string originalVersion;
};

///////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions src/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1508,14 +1508,14 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
if (_sdf->GetName() == "joint" &&
_sdf->Get<std::string>("type") != "ball")
{
Error err(
Error missingElementError(
ErrorCode::ELEMENT_MISSING,
"XML Missing required element[" + elemDesc->GetName() +
"], child of element[" + _sdf->GetName() + "]",
_source,
elemXml->GetLineNum());
err.SetXmlPath(elemXmlPath);
_errors.push_back(err);
_xml->GetLineNum());
missingElementError.SetXmlPath(elemXmlPath);
_errors.push_back(missingElementError);
return false;
}
else
Expand Down
39 changes: 39 additions & 0 deletions src/parser_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,45 @@ TEST(Parser, ElementFilePath)
EXPECT_EQ("", directModel->FilePath());
}

/////////////////////////////////////////////////
/// Check for missing element segfault, #590
TEST(Parser, MissingRequiredElement)
{
const std::string testString = R"(<?xml version="1.0" ?>
<sdf version="1.8">
<world name="default">
<model name="test_model">
<link name="link_0"/>
<link name="link_1"/>
<joint name="joint" type="revolute">
<parent>link_0</parent>
<axis>
<xyz>1 0 0</xyz>
<limit>
<lower>-1</lower>
<upper>1</upper>
</limit>
</axis>
</joint>
</model>
</world>
</sdf>)";

sdf::Errors errors;
sdf::SDFPtr sdf = InitSDF();
EXPECT_FALSE(sdf::readString(testString, sdf, errors));

ASSERT_NE(errors.size(), 0u);
std::cerr << errors[0] << std::endl;

EXPECT_EQ(errors[0].Code(), sdf::ErrorCode::ELEMENT_MISSING);
ASSERT_TRUE(errors[0].FilePath().has_value());
EXPECT_EQ(errors[0].FilePath().value(),
std::string(sdf::kSdfStringSource));
ASSERT_TRUE(errors[0].LineNumber().has_value());
EXPECT_EQ(errors[0].LineNumber().value(), 7);
}

/////////////////////////////////////////////////
/// Main
int main(int argc, char **argv)
Expand Down

0 comments on commit 2be745e

Please sign in to comment.