public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] support: delete unused code
@ 2015-10-06 21:45 Mike Frysinger
  2015-10-07  2:31 ` Brian Dolbec
  2015-10-08 22:11 ` Mike Frysinger
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Frysinger @ 2015-10-06 21:45 UTC (permalink / raw
  To: gentoo-catalyst

Using the vulture tool (and verifying a bit with `git grep`),
delete various bits of code from this module that aren't used.
---
 catalyst/support.py | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/catalyst/support.py b/catalyst/support.py
index f184ed7..62be63a 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -1,7 +1,6 @@
 
 import glob
 import sys
-import string  # pylint: disable=deprecated-module
 import os
 import types
 import re
@@ -11,35 +10,8 @@ from subprocess import Popen
 
 from catalyst.defaults import verbosity, valid_config_file_values
 
-selinux_capable = False
-#userpriv_capable = (os.getuid() == 0)
-#fakeroot_capable = False
-
 BASH_BINARY             = "/bin/bash"
 
-# set it to 0 for the soft limit, 1 for the hard limit
-DESIRED_RLIMIT = 0
-try:
-	import resource
-	max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)[DESIRED_RLIMIT]
-except Exception:
-	# hokay, no resource module.
-	max_fd_limit=256
-
-# pids this process knows of.
-spawned_pids = []
-
-
-# a function to turn a string of non-printable characters
-# into a string of hex characters
-def hexify(s):
-	hexStr = string.hexdigits
-	r = ''
-	for ch in s:
-		i = ord(ch)
-		r = r + hexStr[(i >> 4) & 0xF] + hexStr[i & 0xF]
-	return r
-
 
 def read_from_clst(path):
 	line = ''
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-catalyst] [PATCH] support: delete unused code
  2015-10-06 21:45 [gentoo-catalyst] [PATCH] support: delete unused code Mike Frysinger
@ 2015-10-07  2:31 ` Brian Dolbec
  2015-10-07  4:03   ` Mike Frysinger
  2015-10-08 22:11 ` Mike Frysinger
  1 sibling, 1 reply; 4+ messages in thread
From: Brian Dolbec @ 2015-10-07  2:31 UTC (permalink / raw
  To: gentoo-catalyst

On Tue,  6 Oct 2015 17:45:07 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> Using the vulture tool (and verifying a bit with `git grep`),
> delete various bits of code from this module that aren't used.
> ---
>  catalyst/support.py | 28 ----------------------------
>  1 file changed, 28 deletions(-)
> 
> diff --git a/catalyst/support.py b/catalyst/support.py
> index f184ed7..62be63a 100644
> --- a/catalyst/support.py
> +++ b/catalyst/support.py
> @@ -1,7 +1,6 @@
>  
>  import glob
>  import sys
> -import string  # pylint: disable=deprecated-module
>  import os
>  import types
>  import re
> @@ -11,35 +10,8 @@ from subprocess import Popen
>  
>  from catalyst.defaults import verbosity, valid_config_file_values
>  
> -selinux_capable = False
> -#userpriv_capable = (os.getuid() == 0)
> -#fakeroot_capable = False
> -
>  BASH_BINARY             = "/bin/bash"
>  
> -# set it to 0 for the soft limit, 1 for the hard limit
> -DESIRED_RLIMIT = 0
> -try:
> -	import resource
> -
> max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)[DESIRED_RLIMIT]
> -except Exception:
> -	# hokay, no resource module.
> -	max_fd_limit=256
> -


Are you sure this is not needed?  Because I recall having to fix the
code because the API had changed, otherwise I couldn't get catalyst to
run.  But to be honest, catalyst is the only place I've seen this ever
used.  And so it is likely not needed.


> -# pids this process knows of.
> -spawned_pids = []
> -
> -
> -# a function to turn a string of non-printable characters
> -# into a string of hex characters
> -def hexify(s):
> -	hexStr = string.hexdigits
> -	r = ''
> -	for ch in s:
> -		i = ord(ch)
> -		r = r + hexStr[(i >> 4) & 0xF] + hexStr[i & 0xF]
> -	return r
> -
>  
>  def read_from_clst(path):
>  	line = ''



-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-catalyst] [PATCH] support: delete unused code
  2015-10-07  2:31 ` Brian Dolbec
@ 2015-10-07  4:03   ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2015-10-07  4:03 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 1830 bytes --]

On 06 Oct 2015 19:31, Brian Dolbec wrote:
> On Tue,  6 Oct 2015 17:45:07 -0400 Mike Frysinger wrote:
> > Using the vulture tool (and verifying a bit with `git grep`),
> > delete various bits of code from this module that aren't used.
> > ---
> >  catalyst/support.py | 28 ----------------------------
> >  1 file changed, 28 deletions(-)
> > 
> > diff --git a/catalyst/support.py b/catalyst/support.py
> > index f184ed7..62be63a 100644
> > --- a/catalyst/support.py
> > +++ b/catalyst/support.py
> > @@ -1,7 +1,6 @@
> >  
> >  import glob
> >  import sys
> > -import string  # pylint: disable=deprecated-module
> >  import os
> >  import types
> >  import re
> > @@ -11,35 +10,8 @@ from subprocess import Popen
> >  
> >  from catalyst.defaults import verbosity, valid_config_file_values
> >  
> > -selinux_capable = False
> > -#userpriv_capable = (os.getuid() == 0)
> > -#fakeroot_capable = False
> > -
> >  BASH_BINARY             = "/bin/bash"
> >  
> > -# set it to 0 for the soft limit, 1 for the hard limit
> > -DESIRED_RLIMIT = 0
> > -try:
> > -	import resource
> > -
> > max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)[DESIRED_RLIMIT]
> > -except Exception:
> > -	# hokay, no resource module.
> > -	max_fd_limit=256
> 
> Are you sure this is not needed?  Because I recall having to fix the
> code because the API had changed, otherwise I couldn't get catalyst to
> run.  But to be honest, catalyst is the only place I've seen this ever
> used.  And so it is likely not needed.

as long as we can assume that nothing is importing catalyst,
i can't see code that uses these things

picking max_fd_limit randomly, it was used until this commit:
36610754ba2daca723064021001c5128d83e8f21
where things were gutted significantly.

same goes for selinux_capable
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-catalyst] [PATCH] support: delete unused code
  2015-10-06 21:45 [gentoo-catalyst] [PATCH] support: delete unused code Mike Frysinger
  2015-10-07  2:31 ` Brian Dolbec
@ 2015-10-08 22:11 ` Mike Frysinger
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2015-10-08 22:11 UTC (permalink / raw
  To: gentoo-catalyst

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

i've pushed this now.  people are building on hardened systems w/out
needing to call setrlimit, so presumably things are OK.  if/when it
becomes an issue, we can re-add the code then.  as-is, i'm wasting
time rewriting dead code (e.g. the string handling w/hexify, and i
started to rewrite it even more to use binascii).
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-08 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 21:45 [gentoo-catalyst] [PATCH] support: delete unused code Mike Frysinger
2015-10-07  2:31 ` Brian Dolbec
2015-10-07  4:03   ` Mike Frysinger
2015-10-08 22:11 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox