fix: Cleanup printing ifAlias #4874

Merged
merged 3 commits into from Dec 12, 2016

Projects

None yet

4 participants

@laf
Member
laf commented Oct 24, 2016 edited

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Fixes: #2666
Fixes: #2703

Not sure this is the best way to do this.

Updated display() function to use stripslashes twice. Reason for this is when ifAlias returns "something" we store \something\ (we strip " in snmp_walk() function. So we are then left with \something\ where as now we should just have something.

Other options to deal with this are:

  1. Update ports poller to strip out \ as well. We have the same issue anywhere else though.
  2. Strip out \ in snmp_walk response but does this have a negative impact anywhere else?

This option is the safest way but welcome to suggestions.

@laf laf fix: Cleanup printing ifAlias
c7e3ec7
@f0o

Double stripslashes?

@laf
Member
laf commented Oct 28, 2016

Yes, if you have a " in the description for cisco devices it comes back with " which then turns into \" so a single strip still ends up in "

@f0o
Member
f0o commented Oct 28, 2016

Wouldn't a preg_replace on '//+' be more efficient?

On 28 October 2016 08:18:00 CEST, Neil Lathwood notifications@github.com wrote:

Yes, if you have a " in the description for cisco devices it comes back
with " which then turns into \" so a single strip still ends up in
"

You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#4874 (comment)

@laf
Member
laf commented Oct 28, 2016

Possibly

@laf
Member
laf commented Nov 1, 2016

bump

@f0o

I think a preg_replace approach is more suiting rather than multiple stripslashes

@laf
Member
laf commented Nov 1, 2016

You'd still need to run stripslashes as well as doing a preg_replace so I'm not sure I see the savings with doing that.

@laf
Member
laf commented Nov 13, 2016

bump

@laf
Member
laf commented Nov 20, 2016

bump

@laf laf rebased
21241fa
@laf
Member
laf commented Nov 23, 2016

Rebased

@laf laf rebased
1b5e545
@laf
Member
laf commented Dec 4, 2016

rebased, display() function was updated in another PR so this should no longer be a concern with double stripslashes().

@scrutinizer-notifier

The inspection completed: 4 new issues

@laf laf merged commit 9b9c10e into librenms:master Dec 12, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@laf laf deleted the laf:issue-2666 branch Dec 12, 2016
@VimCommando VimCommando added a commit to VimCommando/librenms that referenced this pull request Jan 4, 2017
@laf @VimCommando laf + VimCommando fix: Cleanup printing ifAlias (#4874) 0644fb0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment